Cap the number of worker threads

Users can configure the number of worker threads. However when it's
not specified the calculated number of workers can get too large on
hosts with a large number of CPUs. Capping only swift proxy server
worker threads when the proxy is in a container. Not capping the
remaining swift services' workers because of the performance impact
it may cause because of the capping.

Change-Id: I12d930552558144ab49fecc0b3776747c1f02166
This commit is contained in:
Ravi Gummadi 2017-03-03 07:44:58 -05:00
parent 78bca6d0ef
commit bb9e3f5828
3 changed files with 23 additions and 6 deletions

View File

@ -178,6 +178,13 @@ swift_rabbitmq_telemetry_servers: "127.0.0.1"
swift_rabbitmq_telemetry_use_ssl: "False"
## General Swift configuration
# We are not capping the default value for these swift variables which define
# the number of worker threads for each of the swift services (except the swift
# proxy workers when proxy is in a container) because of the performace impact
# that may be seen due to capping worker threads for swift services.
# We would like to calculate the default value using vCPUs for good performance
# of swift services.
# If ``swift_account_server_replicator_workers`` is unset the system will use half the number
# of available VCPUS to compute the number of api workers to use.
# swift_account_server_replicator_workers: 16
@ -203,8 +210,13 @@ swift_rabbitmq_telemetry_use_ssl: "False"
# swift_object_server_workers: 16
# If ``swift_proxy_server_workers`` is unset the system will use half the number
# of available VCPUS to compute the number of api workers to use.
# swift_proxy_server_workers: 16
# of available VCPUS to compute the number of api workers to use. Capping this
# value at 16 if the swift proxy is in a container and user did not define
# this variable.
swift_proxy_server_workers_max: 16
swift_proxy_server_workers_not_capped: "{{ [ansible_processor_vcpus|default(2) // 2, 1] | max }}"
swift_proxy_server_workers_capped: "{{ [swift_proxy_server_workers_max, swift_proxy_server_workers_not_capped|int] | min }}"
swift_proxy_server_workers: "{{ (inventory_hostname == physical_host) | ternary(swift_proxy_server_workers_not_capped, swift_proxy_server_workers_capped) }}"
# These are the storage addresses used to define the networks for swift storage and replication
# These are calculated by the tasks based on the "storage_network" and "replication_network" values

View File

@ -0,0 +1,8 @@
---
features:
- Capping the default value for the variable ``swift_proxy_server_workers``
to 16 when the user doesn't configure this variable and if the swift proxy
is in a container. Default value is half the number of vCPUs available on
the machine if the swift proxy is not in a container. Default value is half
the number of vCPUs available on the machine with a capping value of 16
if the proxy is in a container.

View File

@ -1,14 +1,11 @@
# {{ ansible_managed }}
{% set _api_threads = ansible_processor_vcpus|default(2) // 2 %}
{% set api_threads = _api_threads if _api_threads > 0 else 1 %}
[DEFAULT]
# Disable stderr logging
use_stderr = False
bind_ip = 0.0.0.0
bind_port = {{ swift_proxy_port }}
workers = {{ swift_proxy_server_workers | default(api_threads) }}
workers = {{ swift_proxy_server_workers }}
user = {{ swift_system_user_name }}
log_facility = LOG_LOCAL1