Add an option for WSGI pool size

Neutron currently hardcodes the number of
greenlets used to process requests in a process to 1000.
As detailed in
http://lists.openstack.org/pipermail/openstack-dev/2015-December/082717.html

this can cause requests to wait within one process
for available database connection while other processes
remain available.

By adding a wsgi_default_pool_size option functionally
identical to that of Nova, we can lower the number of
greenlets per process to be more in line with a typical
max database connection pool size.

DocImpact: a previously unused configuration value
           wsgi_default_pool_size is now used to affect
           the number of greenlets used by the server. The
           default number of greenlets also changes from 1000
           to 100.
Change-Id: I94cd2f9262e0f330cf006b40bb3c0071086e5d71
(cherry picked from commit 9d573387f1)
This commit is contained in:
Mike Bayer 2016-02-09 13:10:57 -05:00 committed by Kevin Benton
parent cddbcdf601
commit eee9e58ed2
2 changed files with 14 additions and 2 deletions

View File

@ -113,10 +113,10 @@ class WorkerService(worker.NeutronWorker):
class Server(object):
"""Server class to manage multiple WSGI sockets and applications."""
def __init__(self, name, num_threads=1000, disable_ssl=False):
def __init__(self, name, num_threads=None, disable_ssl=False):
# Raise the default from 8192 to accommodate large tokens
eventlet.wsgi.MAX_HEADER_LINE = CONF.max_header_line
self.num_threads = num_threads
self.num_threads = num_threads or CONF.wsgi_default_pool_size
self.disable_ssl = disable_ssl
# Pool for a greenthread in which wsgi server will be running
self.pool = eventlet.GreenPool(1)

View File

@ -0,0 +1,12 @@
---
prelude: >
Support configuration of greenthreads pool for WSGI.
other:
- Operators may want to tune the ``max_overflow`` and
``wsgi_default_pool_size`` configuration options according
to the investigations outlined in this `mailing list post
<http://lists.openstack.org/pipermail/openstack-dev/2015-December/082717.html>`_.
The default value of ``wsgi_default_pool_size`` inherits from
that of oslo.config, which is currently 100. This is
a change in default from the previous Neutron-specific
value of 1000.