Lower the explicit flush count
Initial testing suggests this makes flush consolidation stable, although the CPU usage will be increased as we are more aggressive in flushing messages to the channels.
This commit is contained in:
@@ -4,13 +4,13 @@ import static com.velocitypowered.proxy.VelocityServer.GSON;
|
||||
import static com.velocitypowered.proxy.connection.forge.legacy.LegacyForgeConstants.HANDSHAKE_HOSTNAME_TOKEN;
|
||||
import static com.velocitypowered.proxy.network.Connections.FLOW_HANDLER;
|
||||
import static com.velocitypowered.proxy.network.Connections.FLUSH_CONSOLIDATION;
|
||||
import static com.velocitypowered.proxy.network.Connections.FLUSH_CONSOLIDATION_AMOUNT;
|
||||
import static com.velocitypowered.proxy.network.Connections.FRAME_DECODER;
|
||||
import static com.velocitypowered.proxy.network.Connections.FRAME_ENCODER;
|
||||
import static com.velocitypowered.proxy.network.Connections.HANDLER;
|
||||
import static com.velocitypowered.proxy.network.Connections.MINECRAFT_DECODER;
|
||||
import static com.velocitypowered.proxy.network.Connections.MINECRAFT_ENCODER;
|
||||
import static com.velocitypowered.proxy.network.Connections.READ_TIMEOUT;
|
||||
import static io.netty.handler.flush.FlushConsolidationHandler.DEFAULT_EXPLICIT_FLUSH_AFTER_FLUSHES;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.velocitypowered.api.network.ProtocolVersion;
|
||||
@@ -85,7 +85,7 @@ public class VelocityServerConnection implements MinecraftConnectionAssociation,
|
||||
protected void initChannel(Channel ch) throws Exception {
|
||||
ch.pipeline()
|
||||
.addLast(FLUSH_CONSOLIDATION, new FlushConsolidationHandler(
|
||||
DEFAULT_EXPLICIT_FLUSH_AFTER_FLUSHES, true))
|
||||
FLUSH_CONSOLIDATION_AMOUNT, true))
|
||||
.addLast(READ_TIMEOUT,
|
||||
new ReadTimeoutHandler(server.getConfiguration().getReadTimeout(),
|
||||
TimeUnit.MILLISECONDS))
|
||||
|
@@ -17,6 +17,8 @@ public class Connections {
|
||||
public static final String READ_TIMEOUT = "read-timeout";
|
||||
public static final String FLUSH_CONSOLIDATION = "flush-consolidation";
|
||||
|
||||
public static final int FLUSH_CONSOLIDATION_AMOUNT = 10;
|
||||
|
||||
private Connections() {
|
||||
throw new AssertionError();
|
||||
}
|
||||
|
@@ -1,6 +1,7 @@
|
||||
package com.velocitypowered.proxy.network;
|
||||
|
||||
import static com.velocitypowered.proxy.network.Connections.FLUSH_CONSOLIDATION;
|
||||
import static com.velocitypowered.proxy.network.Connections.FLUSH_CONSOLIDATION_AMOUNT;
|
||||
import static com.velocitypowered.proxy.network.Connections.FRAME_DECODER;
|
||||
import static com.velocitypowered.proxy.network.Connections.FRAME_ENCODER;
|
||||
import static com.velocitypowered.proxy.network.Connections.LEGACY_PING_DECODER;
|
||||
@@ -8,7 +9,6 @@ import static com.velocitypowered.proxy.network.Connections.LEGACY_PING_ENCODER;
|
||||
import static com.velocitypowered.proxy.network.Connections.MINECRAFT_DECODER;
|
||||
import static com.velocitypowered.proxy.network.Connections.MINECRAFT_ENCODER;
|
||||
import static com.velocitypowered.proxy.network.Connections.READ_TIMEOUT;
|
||||
import static io.netty.handler.flush.FlushConsolidationHandler.DEFAULT_EXPLICIT_FLUSH_AFTER_FLUSHES;
|
||||
|
||||
import com.velocitypowered.proxy.VelocityServer;
|
||||
import com.velocitypowered.proxy.connection.MinecraftConnection;
|
||||
@@ -40,7 +40,7 @@ public class ServerChannelInitializer extends ChannelInitializer<Channel> {
|
||||
protected void initChannel(final Channel ch) {
|
||||
ch.pipeline()
|
||||
.addLast(FLUSH_CONSOLIDATION, new FlushConsolidationHandler(
|
||||
DEFAULT_EXPLICIT_FLUSH_AFTER_FLUSHES, true))
|
||||
FLUSH_CONSOLIDATION_AMOUNT, true))
|
||||
.addLast(READ_TIMEOUT,
|
||||
new ReadTimeoutHandler(this.server.getConfiguration().getReadTimeout(),
|
||||
TimeUnit.MILLISECONDS))
|
||||
|
Reference in New Issue
Block a user