Skip to content

Commit dab6353

Browse files
pablomhehelms
authored andcommitted
Change default Puma threads min and max values to match Foreman ones
The values are taken from: https://github.com/theforeman/puppet-foreman/blob/master/manifests/init.pp Because this is the first stab at this, they'll be hardcoded and will be configurable in a later commit.
1 parent 30da213 commit dab6353

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

src/roles/foreman/defaults/main.yaml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,15 @@ foreman_database_sslrootcert:
1212

1313
foreman_url: "http://{{ ansible_facts['fqdn'] }}:3000"
1414

15+
# Puma threads calculation:
16+
# Max calculation is based on the default for MRI https://puma.io/puma6/#thread-pool
17+
# Min calculation is based on testing that showed that having the same value as the max led to
18+
# lower memory usage
19+
foreman_puma_threads_max: 5
20+
foreman_puma_threads_min: "{{ foreman_puma_threads_max }}"
1521
# Puma workers calculation:
16-
# CPU based calculation is based on https://github.com/puma/puma/blob/master/docs/deployment.md#mri
17-
# Memory based calculation is based on https://docs.gitlab.com/ee/install/requirements.html#puma-settings
22+
# CPU calculation is based on https://github.com/puma/puma/blob/master/docs/deployment.md#mri
23+
# Memory calculation is based on https://docs.gitlab.com/ee/install/requirements.html#puma-settings
1824
foreman_puma_workers: "{{ [32, ansible_facts['processor_nproc'] * 1.5, (ansible_facts['memtotal_mb'] / 1024) - 1.5] | min | int }}"
1925

2026
foreman_recurring_tasks_enabled: true

src/roles/foreman/tasks/main.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,8 @@
104104
- 'foreman-client-cert,type=mount,target=/etc/foreman/client_cert.pem'
105105
- 'foreman-client-key,type=mount,target=/etc/foreman/client_key.pem'
106106
env:
107+
FOREMAN_PUMA_THREADS_MIN: "{{ foreman_puma_threads_min }}"
108+
FOREMAN_PUMA_THREADS_MAX: "{{ foreman_puma_threads_max }}"
107109
FOREMAN_PUMA_WORKERS: "{{ foreman_puma_workers }}"
108110
FOREMAN_ENABLED_PLUGINS: "{{ foreman_plugins | join(' ') }}"
109111
quadlet_options:

0 commit comments

Comments
 (0)