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.

Change-Id: Ibd293f102bc0201d5d451549d37458bef352d930
This commit is contained in:
Ravi Gummadi 2017-02-23 00:40:42 -05:00
parent 8a29cb390c
commit c18d9704af
4 changed files with 12 additions and 8 deletions

View File

@ -151,6 +151,10 @@ glance_image_cache_max_size: 10737418240
# compute the number of api workers to use.
# glance_registry_workers: 16
## Cap the maximum number of threads / workers when a user value is unspecified.
glance_api_threads_max: 16
glance_api_threads: "{{ [[ansible_processor_vcpus|default(2) // 2, 1] | max, glance_api_threads_max] | min }}"
glance_task_executor: taskflow
glance_digest_algorithm: sha256
glance_http_keepalive: True

View File

@ -0,0 +1,6 @@
---
features:
- Capping the default value for the variables ``glance_api_workers`` and
``glance_registry_workers`` to 16 when the user doesn't configure
these variables. Default value is half the number of vCPUs available
on the machine with a capping value of 16.

View File

@ -1,8 +1,5 @@
# {{ 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
@ -14,7 +11,7 @@ bind_port = {{ glance_api_service_port }}
http_keepalive = {{ glance_http_keepalive }}
digest_algorithm = {{ glance_digest_algorithm }}
backlog = 4096
workers = {{ glance_api_workers | default(api_threads) }}
workers = {{ glance_api_workers | default(glance_api_threads) }}
registry_host = {{ glance_registry_host }}
registry_port = {{ glance_registry_service_port }}
registry_client_protocol = {{ glance_service_registry_proto }}

View File

@ -1,8 +1,5 @@
# {{ 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
@ -13,7 +10,7 @@ bind_host = {{ glance_registry_bind_address }}
bind_port = {{ glance_registry_service_port }}
http_keepalive = {{ glance_http_keepalive }}
backlog = 4096
workers = {{ glance_registry_workers | default(api_threads) }}
workers = {{ glance_registry_workers | default(glance_api_threads) }}
api_limit_max = 1000
limit_param_default = 25