Permalink
Browse files

[pegasus] Set proper default for HttpServerBuilder class

RB=1236289
G=si-core-reviewers
R=fcapponi
A=fcapponi
  • Loading branch information...
ssheng committed Mar 8, 2018
1 parent 46d8081 commit aa384be91375d9f904972e6434e6260760249dcd
Showing with 33 additions and 10 deletions.
  1. +2 −0 CHANGELOG
  2. +6 −6 build.gradle
  3. +25 −4 r2-netty/src/test/java/com/linkedin/r2/transport/http/client/HttpServerBuilder.java
@@ -4,6 +4,8 @@
Added XXHash as an alternative to MD5 for PartitionAccessor
(RB=1231618)
Enable setting default values for custom type parameters.
(RB=1236289)
Set proper default for HttpServerBuilder class

20.0.4
------
@@ -53,12 +53,12 @@ project.ext.externalDependency = [
'jacksonCoreAsl_1_8': 'org.codehaus.jackson:jackson-core-asl:1.8.8',
'javaxInject': 'javax.inject:javax.inject:1',
'jdkTools': files("${System.getProperty('java.home')}/../lib/tools.jar"),
'jettyAlpnServer': 'org.eclipse.jetty:jetty-alpn-server:9.3.21.M0',
'jettyHttp': 'org.eclipse.jetty:jetty-http:9.3.21.M0',
'jettyHttp2Server': 'org.eclipse.jetty.http2:http2-server:9.3.21.M0',
'jettyServlet': 'org.eclipse.jetty:jetty-servlet:9.3.21.M0',
'jettyServer': 'org.eclipse.jetty:jetty-server:9.3.21.M0',
'jettyUtil': 'org.eclipse.jetty:jetty-util:9.3.21.M0',
'jettyAlpnServer': 'org.eclipse.jetty:jetty-alpn-server:9.3.21.v20170918',
'jettyHttp': 'org.eclipse.jetty:jetty-http:9.3.21.v20170918',
'jettyHttp2Server': 'org.eclipse.jetty.http2:http2-server:9.3.21.v20170918',
'jettyServlet': 'org.eclipse.jetty:jetty-servlet:9.3.21.v20170918',
'jettyServer': 'org.eclipse.jetty:jetty-server:9.3.21.v20170918',
'jettyUtil': 'org.eclipse.jetty:jetty-util:9.3.21.v20170918',
"jmhCore": "org.openjdk.jmh:jmh-core:1.11",
"jmhAnnotations": "org.openjdk.jmh:jmh-generator-annprocess:1.11",
'log4j2Api': 'org.apache.logging.log4j:log4j-api:2.0.2',
@@ -55,16 +55,30 @@
private int _status = 200;
private int _minThreads = 0;
private int _maxThreads = 150;
private long _idleTimeout = 30000;
private long _idleTimeout = 35000;
private long _stopTimeout = 30000;
private long _blockingTimeout = 30000;
private CountDownLatch _responseLatch = null;
private Consumer<Throwable> _exceptionListener = null;
private HttpServerStatsProvider _serverStatsProvider = new HttpServerStatsProvider();

// HTTP/2 settings
/**
* Max concurrent streams is the maximum number of streams allowed in a HTTP/2 session, 256 streams by default.
*/
private int _maxConcurrentStreams = 256;
private int _initialSessionRecvWindow = 64 * 1024;
private int _initialStreamRecvWindow = 256 * 64 * 1024;

/**
* Flow control window size of an individual HTTP/2 stream, 64KiB by default.
*/
private int _initialStreamRecvWindow = 64 * 1024;

/**
* Flow control window size of the entire HTTP/2 session. The value is set to the product of stream window and
* and the number streams and multiply by two, to effectively disable session level flow control. Session level
* flow control is undesirable because the server is synchronous and the number of threads is fewer than the
* number of streams.
*/
private int _initialSessionRecvWindow = _maxConcurrentStreams * _initialStreamRecvWindow * 2;

public HttpServerBuilder status(int status)
{
@@ -90,6 +104,12 @@ public HttpServerBuilder idleTimeout(long idleTimeout)
return this;
}

public HttpServerBuilder blockingTimeout(long blockingTimeout)
{
_blockingTimeout = blockingTimeout;
return this;
}

public HttpServerBuilder responseLatch(CountDownLatch responseLatch)
{
_responseLatch = responseLatch;
@@ -162,6 +182,7 @@ public Server build()
configuration.setSendXPoweredBy(false);
configuration.setSendServerVersion(false);
configuration.setSendDateHeader(false);
configuration.setBlockingTimeout(_blockingTimeout);

// HTTP connection factory
HttpConnectionFactory httpConnectionFactory = new HttpConnectionFactory(configuration);

0 comments on commit aa384be

Please sign in to comment.