Skip to content
This repository has been archived by the owner on Oct 15, 2019. It is now read-only.

Commit

Permalink
make accept backlog tunable
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewcox committed Feb 22, 2014
1 parent a03b01c commit 6fd662a
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,18 @@
import com.google.inject.Provider;

public class LoadTesterNettyConfigProvider implements Provider<NettyServerConfig> {
public LoadTesterNettyConfigProvider() {
private final NiftyLoadTester.LoadTesterConfig config;

@Inject
public LoadTesterNettyConfigProvider(NiftyLoadTester.LoadTesterConfig config)
{
this.config = config;
}

@Override
public NettyServerConfig get() {
NettyServerConfigBuilder configBuilder = new NettyServerConfigBuilder();
configBuilder.getServerSocketChannelConfig().setBacklog(1024);
configBuilder.getServerSocketChannelConfig().setBacklog(config.getAcceptBacklog());
return configBuilder.build();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ public static class LoadTesterConfig
private boolean useTaskQueue = false;
private int numTaskThreads = 8;
private int queuedResponseLimit = 500;
private int acceptBacklog = 1024;

public int getServerPort()
{
Expand Down Expand Up @@ -171,5 +172,16 @@ public void setQueuedResponseLimit(int queuedResponseLimit)
{
this.queuedResponseLimit = queuedResponseLimit;
}

public int getAcceptBacklog()
{
return acceptBacklog;
}

@Config("acceptBacklog")
public void setAcceptBacklog(int acceptBacklog)
{
this.acceptBacklog = acceptBacklog;
}
}
}

0 comments on commit 6fd662a

Please sign in to comment.