# HG changeset patch # User Adrien Di Mascio # Date 1310380745 -7200 # Node ID 7a09144696182bb8e8bda5f397d6784fe9dbcb54 # Parent f3e3892fc7e3ca6d4880df2351f0a0f7357e5a66 [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. diff -r f3e3892fc7e3 -r 7a0914469618 etwist/server.py --- 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': diff -r f3e3892fc7e3 -r 7a0914469618 etwist/twconfig.py --- 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):