Make the number of workers for account, container and object servers a multiplier of the number of CPUs, and default to a sensible setting per recommendations in http://docs.openstack.org/developer/swift/deployment_guide.html#general-service-tuning

This commit is contained in:
Tom Haddon 2014-06-18 11:18:02 +01:00
parent 77743f3db6
commit ee219bdd38
6 changed files with 13 additions and 5 deletions

View File

@ -49,4 +49,9 @@ options:
default: 6002 default: 6002
type: int type: int
description: Listening port of the swift-account-server. description: Listening port of the swift-account-server.
worker-multiplier:
default: 1
type: int
description: |
The CPU multiplier to use when configuring worker processes for the
account, container and object server processes.

View File

@ -61,10 +61,13 @@ class SwiftStorageServerContext(OSContextGenerator):
interfaces = [] interfaces = []
def __call__(self): def __call__(self):
import psutil
multiplier = config('worker-multiplier') or 1
ctxt = { ctxt = {
'local_ip': unit_private_ip(), 'local_ip': unit_private_ip(),
'account_server_port': config('account-server-port'), 'account_server_port': config('account-server-port'),
'container_server_port': config('container-server-port'), 'container_server_port': config('container-server-port'),
'object_server_port': config('object-server-port'), 'object_server_port': config('object-server-port'),
'workers': psutil.NUM_CPUS * multiplier,
} }
return ctxt return ctxt

View File

@ -48,7 +48,7 @@ from charmhelpers.contrib.openstack import (
PACKAGES = [ PACKAGES = [
'swift', 'swift-account', 'swift-container', 'swift-object', 'swift', 'swift-account', 'swift-container', 'swift-object',
'xfsprogs', 'gdisk', 'lvm2', 'python-jinja2', 'xfsprogs', 'gdisk', 'lvm2', 'python-jinja2', 'python-psutil',
] ]
TEMPLATES = 'templates/' TEMPLATES = 'templates/'

View File

@ -1,7 +1,7 @@
[DEFAULT] [DEFAULT]
bind_ip = 0.0.0.0 bind_ip = 0.0.0.0
bind_port = {{ account_server_port }} bind_port = {{ account_server_port }}
workers = 2 workers = {{ workers }}
[pipeline:main] [pipeline:main]
pipeline = recon account-server pipeline = recon account-server

View File

@ -1,7 +1,7 @@
[DEFAULT] [DEFAULT]
bind_ip = 0.0.0.0 bind_ip = 0.0.0.0
bind_port = {{ container_server_port }} bind_port = {{ container_server_port }}
workers = 2 workers = {{ workers }}
[pipeline:main] [pipeline:main]
pipeline = recon container-server pipeline = recon container-server

View File

@ -1,7 +1,7 @@
[DEFAULT] [DEFAULT]
bind_ip = 0.0.0.0 bind_ip = 0.0.0.0
bind_port = {{ object_server_port }} bind_port = {{ object_server_port }}
workers = 2 workers = {{ workers }}
[pipeline:main] [pipeline:main]
pipeline = recon object-server pipeline = recon object-server