Skip to content

Commit

Permalink
benchmarks: fix missing configuration for netty server (#6877)
Browse files Browse the repository at this point in the history
  • Loading branch information
creamsoup committed Mar 31, 2020
1 parent 68391e4 commit ae211a1
Showing 1 changed file with 6 additions and 2 deletions.
Expand Up @@ -40,6 +40,8 @@
import io.netty.channel.local.LocalChannel;
import io.netty.channel.local.LocalServerChannel;
import io.netty.channel.nio.NioEventLoopGroup;
import io.netty.channel.socket.nio.NioServerSocketChannel;
import io.netty.channel.socket.nio.NioSocketChannel;
import io.netty.util.concurrent.DefaultThreadFactory;
import java.net.InetAddress;
import java.net.InetSocketAddress;
Expand Down Expand Up @@ -206,8 +208,9 @@ public void setup(ExecutorType clientExecutor,
sock.bind(new InetSocketAddress(BENCHMARK_ADDR, 0));
SocketAddress address = sock.getLocalSocketAddress();
sock.close();
serverBuilder = NettyServerBuilder.forAddress(address);
channelBuilder = NettyChannelBuilder.forAddress(address);
serverBuilder =
NettyServerBuilder.forAddress(address).channelType(NioServerSocketChannel.class);
channelBuilder = NettyChannelBuilder.forAddress(address).channelType(NioSocketChannel.class);
}

if (serverExecutor == ExecutorType.DIRECT) {
Expand All @@ -220,6 +223,7 @@ public void setup(ExecutorType clientExecutor,
// Always use a different worker group from the client.
ThreadFactory serverThreadFactory = new DefaultThreadFactory("STF pool", true /* daemon */);
serverBuilder.workerEventLoopGroup(new NioEventLoopGroup(0, serverThreadFactory));
serverBuilder.bossEventLoopGroup(new NioEventLoopGroup(1, serverThreadFactory));

// Always set connection and stream window size to same value
serverBuilder.flowControlWindow(windowSize.bytes());
Expand Down

0 comments on commit ae211a1

Please sign in to comment.