Merge pull request #1240 from himanshug/async_query_forwarding_servlet_router_fix

adding router numMaxThread configuration for ProxyServlet HttpClient executor
This commit is contained in:
Xavier Léauté 2015-03-26 10:15:44 -07:00
commit 47cc11829d
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.numConnections=50
druid.router.http.readTimeout=PT5M 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 druid.server.http.numThreads=100
``` ```

View File

@ -35,6 +35,10 @@ public class DruidHttpClientConfig
@JsonProperty @JsonProperty
private Period readTimeout = new Period("PT15M"); 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() public int getNumConnections()
{ {
return numConnections; return numConnections;
@ -44,4 +48,9 @@ public class DruidHttpClientConfig
{ {
return readTimeout == null ? null : readTimeout.toStandardDuration(); return readTimeout == null ? null : readTimeout.toStandardDuration();
} }
public int getNumMaxThreads()
{
return numMaxThreads;
}
} }

View File

@ -89,7 +89,11 @@ public class RouterJettyServerInitializer implements JettyServerInitializer
requestLogger requestLogger
); );
asyncQueryForwardingServlet.setTimeout(httpClientConfig.getReadTimeout().getMillis()); 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); JettyServerInitUtils.addExtensionFilters(root, injector);
root.addFilter(JettyServerInitUtils.defaultAsyncGzipFilterHolder(), "/*", null); root.addFilter(JettyServerInitUtils.defaultAsyncGzipFilterHolder(), "/*", null);
// Can't use '/*' here because of Guice conflicts with AsyncQueryForwardingServlet path // Can't use '/*' here because of Guice conflicts with AsyncQueryForwardingServlet path