[twisted] add an option to configure twisted's threadpool size
Twisted's threadpool size defaults to 10, which means we virtually try
to serve up to 10 simulateneous requests but connection-pool size
defaults to 4 on CW-server side. That means that under heavy load, chances
are high that some HTTP queries end up with a 500 error code / connection-pool
exhausted.
--- a/etwist/server.py Mon Jul 11 11:56:47 2011 +0200
+++ b/etwist/server.py Mon Jul 11 12:39:05 2011 +0200
@@ -507,6 +507,7 @@
# serve it via standard HTTP on port set in the configuration
port = config['port'] or 8080
interface = config['interface']
+ reactor.suggestThreadPoolSize(config['webserver-threadpool-size'])
reactor.listenTCP(port, website, interface=interface)
if not config.debugmode:
if sys.platform == 'win32':
--- a/etwist/twconfig.py Mon Jul 11 11:56:47 2011 +0200
+++ b/etwist/twconfig.py Mon Jul 11 12:39:05 2011 +0200
@@ -90,6 +90,13 @@
'help': 'run a pyro server',
'group': 'main', 'level': 1,
}),
+ ('webserver-threadpool-size',
+ {'type': 'int',
+ 'default': 4,
+ 'help': "size of twisted's reactor threadpool. It should probably be not too \
+much greater than connection-poolsize",
+ 'group': 'web', 'level': 3,
+ }),
) + WebConfiguration.options)
def server_file(self):