Skip to content

Commit

Permalink
Cap the number of worker threads
Browse files Browse the repository at this point in the history
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: I86990deffcf9c29d39190defb0e2178a39de2aba
  • Loading branch information
ravigumm authored and Jesse Pretorius (odyssey4me) committed Feb 24, 2017
1 parent d016be1 commit 9bbe02e
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
4 changes: 4 additions & 0 deletions defaults/main.yml
Expand Up @@ -108,6 +108,10 @@ ceilometer_service_in_ldap: false
# ceilometer_collector_workers: 1
# ceilometer_notification_workers: 1

## Cap the maximum number of threads / workers when a user value is unspecified.
ceilometer_api_threads_max: 16
ceilometer_api_threads: "{{ [[ansible_processor_vcpus|default(2) // 2, 1] | max, ceilometer_api_threads_max] | min }}"

# Enable/Disable Ceilometer per service
glance_ceilometer_enabled: false
nova_ceilometer_enabled: false
Expand Down
@@ -0,0 +1,6 @@
---
features:
- Capping the default value for the variables
``ceilometer_api_workers`` and ``ceilometer_notification_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.
7 changes: 2 additions & 5 deletions templates/ceilometer.conf.j2
@@ -1,8 +1,5 @@
#{{ ansible_managed}}

{% set _workers = ansible_processor_vcpus|default(2) // 2 %}
{% set workers = _workers if _workers > 0 else 1 %}

[DEFAULT]
# Disable stderr logging
use_stderr = False
Expand Down Expand Up @@ -33,7 +30,7 @@ rabbit_use_ssl = {{ ceilometer_rabbitmq_use_ssl }}

[api]
gnocchi_is_enabled = {{ ceilometer_gnocchi_enabled | bool }}
workers = {{ ceilometer_api_workers | default(workers) }}
workers = {{ ceilometer_api_workers | default(ceilometer_api_threads) }}
port = 8777

[collector]
Expand All @@ -44,7 +41,7 @@ batch_timeout = 5
{% endif %}

[notification]
workers = {{ ceilometer_notification_workers | default(workers) }}
workers = {{ ceilometer_notification_workers | default(ceilometer_api_threads) }}
store_events = {{ not ceilometer_gnocchi_enabled | bool }}

# Notification queues to listen on
Expand Down

0 comments on commit 9bbe02e

Please sign in to comment.