[jamespage,r=gnuoy] Add support for worker process configuration
This commit is contained in:
@@ -211,3 +211,10 @@ options:
|
|||||||
order for this charm to function correctly, the privacy extension must be
|
order for this charm to function correctly, the privacy extension must be
|
||||||
disabled and a non-temporary address must be configured/available on
|
disabled and a non-temporary address must be configured/available on
|
||||||
your network interface.
|
your network interface.
|
||||||
|
worker-multiplier:
|
||||||
|
type: int
|
||||||
|
default: 2
|
||||||
|
description: |
|
||||||
|
The CPU core multiplier to use when configuring worker processes for
|
||||||
|
Keystone. By default, the number of workers for each daemon is set to
|
||||||
|
twice the number of CPU cores a service unit has.
|
||||||
|
@@ -903,3 +903,22 @@ class BindHostContext(OSContextGenerator):
|
|||||||
return {
|
return {
|
||||||
'bind_host': '0.0.0.0'
|
'bind_host': '0.0.0.0'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
class WorkerConfigContext(OSContextGenerator):
|
||||||
|
|
||||||
|
@property
|
||||||
|
def num_cpus(self):
|
||||||
|
try:
|
||||||
|
from psutil import NUM_CPUS
|
||||||
|
except ImportError:
|
||||||
|
apt_install('python-psutil', fatal=True)
|
||||||
|
from psutil import NUM_CPUS
|
||||||
|
return NUM_CPUS
|
||||||
|
|
||||||
|
def __call__(self):
|
||||||
|
multiplier = config('worker-multiplier') or 1
|
||||||
|
ctxt = {
|
||||||
|
"workers": self.num_cpus * multiplier
|
||||||
|
}
|
||||||
|
return ctxt
|
||||||
|
@@ -115,7 +115,8 @@ BASE_RESOURCE_MAP = OrderedDict([
|
|||||||
context.PostgresqlDBContext(),
|
context.PostgresqlDBContext(),
|
||||||
context.SyslogContext(),
|
context.SyslogContext(),
|
||||||
keystone_context.HAProxyContext(),
|
keystone_context.HAProxyContext(),
|
||||||
context.BindHostContext()],
|
context.BindHostContext(),
|
||||||
|
context.WorkerConfigContext()],
|
||||||
}),
|
}),
|
||||||
(HAPROXY_CONF, {
|
(HAPROXY_CONF, {
|
||||||
'contexts': [context.HAProxyContext(),
|
'contexts': [context.HAProxyContext(),
|
||||||
|
@@ -14,6 +14,8 @@ verbose = {{ verbose }}
|
|||||||
public_endpoint = {{ public_endpoint }}
|
public_endpoint = {{ public_endpoint }}
|
||||||
admin_endpoint = {{ admin_endpoint }}
|
admin_endpoint = {{ admin_endpoint }}
|
||||||
bind_host = {{ bind_host }}
|
bind_host = {{ bind_host }}
|
||||||
|
public_workers = {{ workers }}
|
||||||
|
admin_workers = {{ workers }}
|
||||||
|
|
||||||
[database]
|
[database]
|
||||||
{% if database_host -%}
|
{% if database_host -%}
|
||||||
|
Reference in New Issue
Block a user