adding router numMaxThread configuration for ProxyServlet HttpClient executor

This commit is contained in:
Himanshu Gupta 2015-03-23 21:46:27 -05:00
parent a5505ec05f
commit b131a4fd3b
3 changed files with 17 additions and 1 deletions

View File

@ -56,6 +56,9 @@ druid.router.tierToBrokerMap={"hot":"druid:prod:broker-hot","_default_tier":"dru
druid.router.http.numConnections=50
druid.router.http.readTimeout=PT5M
# Number of threads used by the router proxy http client
druid.router.http.numMaxThreads=100
druid.server.http.numThreads=100
```

View File

@ -35,6 +35,10 @@ public class DruidHttpClientConfig
@JsonProperty
private Period readTimeout = new Period("PT15M");
@JsonProperty
@Min(1)
private int numMaxThreads = Math.max(10, (Runtime.getRuntime().availableProcessors() * 17) / 16 + 2) + 30;
public int getNumConnections()
{
return numConnections;
@ -44,4 +48,9 @@ public class DruidHttpClientConfig
{
return readTimeout == null ? null : readTimeout.toStandardDuration();
}
public int getNumMaxThreads()
{
return numMaxThreads;
}
}

View File

@ -89,7 +89,11 @@ public class RouterJettyServerInitializer implements JettyServerInitializer
requestLogger
);
asyncQueryForwardingServlet.setTimeout(httpClientConfig.getReadTimeout().getMillis());
root.addServlet(new ServletHolder(asyncQueryForwardingServlet), "/druid/v2/*");
ServletHolder sh = new ServletHolder(asyncQueryForwardingServlet);
//NOTE: explicit maxThreads to workaround https://tickets.puppetlabs.com/browse/TK-152
sh.setInitParameter("maxThreads", Integer.toString(httpClientConfig.getNumMaxThreads()));
root.addServlet(sh, "/druid/v2/*");
JettyServerInitUtils.addExtensionFilters(root, injector);
root.addFilter(JettyServerInitUtils.defaultAsyncGzipFilterHolder(), "/*", null);
// Can't use '/*' here because of Guice conflicts with AsyncQueryForwardingServlet path