Merge "Set the default number of workers when running under eventlet"
This commit is contained in:
commit
b2c50822a6
|
@ -47,6 +47,7 @@ from keystone.common import sql
|
|||
from keystone.common import utils
|
||||
from keystone import config
|
||||
from keystone.i18n import _
|
||||
from keystone.openstack.common import processutils
|
||||
from keystone.openstack.common import service
|
||||
from keystone.openstack.common import systemd
|
||||
from keystone import service as keystone_service
|
||||
|
@ -104,6 +105,15 @@ def serve(*servers):
|
|||
launcher.wait()
|
||||
|
||||
|
||||
def _get_workers(worker_type_config_opt):
|
||||
# Get the value from config, if the config value is None (not set), return
|
||||
# the number of cpus with a minimum of 2.
|
||||
worker_count = CONF.get(worker_type_config_opt)
|
||||
if not worker_count:
|
||||
worker_count = max(2, processutils.get_worker_count())
|
||||
return worker_count
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
dev_conf = os.path.join(possible_topdir,
|
||||
'etc',
|
||||
|
@ -136,17 +146,20 @@ if __name__ == '__main__':
|
|||
|
||||
backends.load_backends()
|
||||
|
||||
admin_worker_count = _get_workers('admin_workers')
|
||||
public_worker_count = _get_workers('public_workers')
|
||||
|
||||
servers = []
|
||||
servers.append(create_server(paste_config,
|
||||
'admin',
|
||||
CONF.admin_bind_host,
|
||||
int(CONF.admin_port),
|
||||
CONF.admin_workers))
|
||||
admin_worker_count))
|
||||
servers.append(create_server(paste_config,
|
||||
'main',
|
||||
CONF.public_bind_host,
|
||||
int(CONF.public_port),
|
||||
CONF.public_workers))
|
||||
public_worker_count))
|
||||
|
||||
dependency.resolve_future_dependencies()
|
||||
serve(*servers)
|
||||
|
|
|
@ -60,12 +60,14 @@
|
|||
#admin_endpoint=<None>
|
||||
|
||||
# The number of worker processes to serve the public WSGI
|
||||
# application (integer value)
|
||||
#public_workers=1
|
||||
# application. Defaults to number of CPUs (minimum of 2).
|
||||
# (integer value)
|
||||
#public_workers=<None>
|
||||
|
||||
# The number of worker processes to serve the admin WSGI
|
||||
# application (integer value)
|
||||
#admin_workers=1
|
||||
# application. Defaults to number of CPUs (minimum of 2).
|
||||
# (integer value)
|
||||
#admin_workers=<None>
|
||||
|
||||
# Enforced by optional sizelimit middleware
|
||||
# (keystone.middleware:RequestBodySizeLimiter). (integer
|
||||
|
@ -172,6 +174,10 @@
|
|||
# Whether to disable the Nagle algorithm. (boolean value)
|
||||
#qpid_tcp_nodelay=true
|
||||
|
||||
# The number of prefetched messages held by receiver. (integer
|
||||
# value)
|
||||
#qpid_receiver_capacity=1
|
||||
|
||||
# The qpid topology version to use. Version 1 is what was
|
||||
# originally used by impl_qpid. Version 2 includes some
|
||||
# backwards-incompatible changes that allow broker federation
|
||||
|
@ -1281,7 +1287,7 @@
|
|||
# backend. (integer value)
|
||||
#expiration_buffer=1800
|
||||
|
||||
# Toggle for revocation event cacheing. This has no effect
|
||||
# Toggle for revocation event caching. This has no effect
|
||||
# unless global caching is enabled. (boolean value)
|
||||
#caching=true
|
||||
|
||||
|
@ -1476,13 +1482,13 @@
|
|||
# Controls the token construction, validation, and revocation
|
||||
# operations. Core providers are
|
||||
# "keystone.token.providers.[pkiz|pki|uuid].Provider". The
|
||||
# default provider is pkiz. (string value)
|
||||
# default provider is uuid. (string value)
|
||||
#provider=<None>
|
||||
|
||||
# Token persistence backend driver. (string value)
|
||||
#driver=keystone.token.persistence.backends.sql.Token
|
||||
|
||||
# Toggle for token system cacheing. This has no effect unless
|
||||
# Toggle for token system caching. This has no effect unless
|
||||
# global caching is enabled. (boolean value)
|
||||
#caching=true
|
||||
|
||||
|
|
|
@ -77,12 +77,14 @@ FILE_OPTIONS = {
|
|||
'to set this value if the base URL contains a path '
|
||||
'(e.g. /prefix/v2.0) or the endpoint should be found '
|
||||
'on a different server.'),
|
||||
cfg.IntOpt('public_workers', default=1,
|
||||
cfg.IntOpt('public_workers',
|
||||
help='The number of worker processes to serve the public '
|
||||
'WSGI application'),
|
||||
cfg.IntOpt('admin_workers', default=1,
|
||||
'WSGI application. Defaults to number of CPUs '
|
||||
'(minimum of 2).'),
|
||||
cfg.IntOpt('admin_workers',
|
||||
help='The number of worker processes to serve the admin '
|
||||
'WSGI application'),
|
||||
'WSGI application. Defaults to number of CPUs '
|
||||
'(minimum of 2).'),
|
||||
# default max request size is 112k
|
||||
cfg.IntOpt('max_request_body_size', default=114688,
|
||||
help='Enforced by optional sizelimit middleware '
|
||||
|
|
Loading…
Reference in New Issue