Commit 9bb61406 authored by Guus der Kinderen's avatar Guus der Kinderen

OF-999: Allow configuration of BOSH worker thread pool

The thread pool that performs processing of data received through the HTTP-based
connections of BOSH (as provided by Jetty) should not have a hardcoded upper bound.
Instead, the pool size should be configurable.

For other connection types, this is managed by properties named as such:
 - xmpp.client.processing.threads (client sockets)
 - xmpp.multiplex.processing.threads (connection managers)
 - xmpp.component.processing.threads (components)

BOSH does have a similar property: httpbind.client.processing.threads
It's value however is not used to configure the amount of worker threads. It is
used to configure the amount of (NIO) acceptors instead. In NIO, acceptor
threads handle network IO, and hand off processing to the worker threads.

There's little benefit in being able to configure the amount of acceptors, as
Jetty will default to a platform-specific default (based on the number of CPUs
that are available). There is greater benefit in being able to configure the
amount of worker threads (as that's more likely to affect throughput).
parent c58efa58
...@@ -96,7 +96,7 @@ public final class HttpBindManager { ...@@ -96,7 +96,7 @@ public final class HttpBindManager {
public static final String HTTP_BIND_AUTH_PER_CLIENTCERT_POLICY = "httpbind.client.cert.policy"; public static final String HTTP_BIND_AUTH_PER_CLIENTCERT_POLICY = "httpbind.client.cert.policy";
public static final int HTTP_BIND_THREADS_DEFAULT = 8; public static final int HTTP_BIND_THREADS_DEFAULT = 200;
private static final String HTTP_BIND_FORWARDED = "httpbind.forwarded.enabled"; private static final String HTTP_BIND_FORWARDED = "httpbind.forwarded.enabled";
...@@ -224,13 +224,12 @@ public final class HttpBindManager { ...@@ -224,13 +224,12 @@ public final class HttpBindManager {
return JiveGlobals.getBooleanProperty(HTTP_BIND_ENABLED, HTTP_BIND_ENABLED_DEFAULT); return JiveGlobals.getBooleanProperty(HTTP_BIND_ENABLED, HTTP_BIND_ENABLED_DEFAULT);
} }
private void createConnector(int port, int bindThreads) { private void createConnector(int port) {
httpConnector = null; httpConnector = null;
if (port > 0) { if (port > 0) {
HttpConfiguration httpConfig = new HttpConfiguration(); HttpConfiguration httpConfig = new HttpConfiguration();
configureProxiedConnector(httpConfig); configureProxiedConnector(httpConfig);
ServerConnector connector = new ServerConnector(httpBindServer, null, null, null, -1, bindThreads, ServerConnector connector = new ServerConnector(httpBindServer, new HttpConnectionFactory(httpConfig));
new HttpConnectionFactory(httpConfig));
// Listen on a specific network interface if it has been set. // Listen on a specific network interface if it has been set.
connector.setHost(getBindInterface()); connector.setHost(getBindInterface());
...@@ -239,7 +238,7 @@ public final class HttpBindManager { ...@@ -239,7 +238,7 @@ public final class HttpBindManager {
} }
} }
private void createSSLConnector(int securePort, int bindThreads) { private void createSSLConnector(int securePort) {
httpsConnector = null; httpsConnector = null;
try { try {
final IdentityStore identityStore = XMPPServer.getInstance().getCertificateStoreManager().getIdentityStore( ConnectionType.BOSH_C2S ); final IdentityStore identityStore = XMPPServer.getInstance().getCertificateStoreManager().getIdentityStore( ConnectionType.BOSH_C2S );
...@@ -265,10 +264,10 @@ public final class HttpBindManager { ...@@ -265,10 +264,10 @@ public final class HttpBindManager {
if ("npn".equals(JiveGlobals.getXMLProperty("spdy.protocol", ""))) if ("npn".equals(JiveGlobals.getXMLProperty("spdy.protocol", "")))
{ {
sslConnector = new HTTPSPDYServerConnector(httpBindServer, sslContextFactory); sslConnector = new HTTPSPDYServerConnector(httpBindServer, sslContextFactory);
} else { }
else
sslConnector = new ServerConnector(httpBindServer, null, null, null, -1, bindThreads, {
new SslConnectionFactory(sslContextFactory, "http/1.1"), new HttpConnectionFactory(httpsConfig)); sslConnector = new ServerConnector(httpBindServer, new SslConnectionFactory(sslContextFactory, "http/1.1"), new HttpConnectionFactory(httpsConfig));
} }
sslConnector.setHost(getBindInterface()); sslConnector.setHost(getBindInterface());
sslConnector.setPort(securePort); sslConnector.setPort(securePort);
...@@ -504,9 +503,9 @@ public final class HttpBindManager { ...@@ -504,9 +503,9 @@ public final class HttpBindManager {
*/ */
private synchronized void configureHttpBindServer(int port, int securePort) { private synchronized void configureHttpBindServer(int port, int securePort) {
// this is the number of threads allocated to each connector/port // this is the number of threads allocated to each connector/port
int bindThreads = JiveGlobals.getIntProperty(HTTP_BIND_THREADS, HTTP_BIND_THREADS_DEFAULT); final int processingThreads = JiveGlobals.getIntProperty(HTTP_BIND_THREADS, HTTP_BIND_THREADS_DEFAULT);
final QueuedThreadPool tp = new QueuedThreadPool(); final QueuedThreadPool tp = new QueuedThreadPool(processingThreads);
tp.setName("Jetty-QTP-BOSH"); tp.setName("Jetty-QTP-BOSH");
httpBindServer = new Server(tp); httpBindServer = new Server(tp);
...@@ -515,8 +514,8 @@ public final class HttpBindManager { ...@@ -515,8 +514,8 @@ public final class HttpBindManager {
httpBindServer.addBean(jmx.getContainer()); httpBindServer.addBean(jmx.getContainer());
} }
createConnector(port, bindThreads); createConnector(port);
createSSLConnector(securePort, bindThreads); createSSLConnector(securePort);
if (httpConnector == null && httpsConnector == null) { if (httpConnector == null && httpsConnector == null) {
httpBindServer = null; httpBindServer = null;
return; return;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment