Skip to content

Commit c530f56

Browse files
authored
Pass parameters of puma_worker_killer to puma config (#2124)
1 parent c1e63f5 commit c530f56

File tree

4 files changed

+7
-1
lines changed

4 files changed

+7
-1
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -933,6 +933,8 @@ Below is the complete list of available options that can be used to customize yo
933933
| `PUMA_TIMEOUT` | Sets the timeout of puma worker processes. Defaults to `60` seconds. |
934934
| `PUMA_THREADS_MIN` | The number of puma minimum threads. Defaults to `1`. |
935935
| `PUMA_THREADS_MAX` | The number of puma maximum threads. Defaults to `16`. |
936+
| `PUMA_PER_WORKER_MAX_MEMORY_MB` | Maximum memory size of per puma worker process. Defaults to `850`. |
937+
| `PUMA_MASTER_MAX_MEMORY_MB` | Maximum memory size of puma master process. Defaults to `550`. |
936938
| `SIDEKIQ_CONCURRENCY` | The number of concurrent sidekiq jobs to run. Defaults to `25` |
937939
| `SIDEKIQ_SHUTDOWN_TIMEOUT` | Timeout for sidekiq shutdown. Defaults to `4` |
938940
| `SIDEKIQ_MEMORY_KILLER_MAX_RSS` | Non-zero value enables the SidekiqMemoryKiller. Defaults to `1000000`. For additional options refer [Configuring the MemoryKiller](http://doc.gitlab.com/ce/operations/sidekiq_memory_killer.html) |

assets/runtime/config/gitlabhq/puma.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555

5656
before_fork do
5757
# Signal to the puma killer
58-
Gitlab::Cluster::PumaWorkerKillerInitializer.start @config.options unless ENV['DISABLE_PUMA_WORKER_KILLER']
58+
Gitlab::Cluster::PumaWorkerKillerInitializer.start(@config.options, puma_per_worker_max_memory_mb: {{PUMA_PER_WORKER_MAX_MEMORY_MB}}, puma_master_max_memory_mb: {{PUMA_MASTER_MAX_MEMORY_MB}}) unless ENV['DISABLE_PUMA_WORKER_KILLER']
5959

6060
# Signal application hooks that we're about to fork
6161
Gitlab::Cluster::LifecycleEvents.do_before_fork

assets/runtime/env-defaults

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,8 @@ PUMA_THREADS_MIN=${PUMA_THREADS_MIN:-1}
6666
PUMA_THREADS_MAX=${PUMA_THREADS_MAX:-16}
6767
PUMA_WORKERS=${PUMA_WORKERS:-3}
6868
PUMA_TIMEOUT=${PUMA_TIMEOUT:-60}
69+
PUMA_PER_WORKER_MAX_MEMORY_MB=${PUMA_PER_WORKER_MAX_MEMORY_MB:-850}
70+
PUMA_MASTER_MAX_MEMORY_MB=${PUMA_MASTER_MAX_MEMORY_MB:-550}
6971

7072
# Set Default values according to the documentation
7173
# https://docs.gitlab.com/ee/administration/operations/unicorn.html#unicorn-worker-killer

assets/runtime/functions

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,8 @@ gitlab_configure_puma() {
278278
PUMA_THREADS_MIN \
279279
PUMA_THREADS_MAX \
280280
PUMA_WORKERS \
281+
PUMA_PER_WORKER_MAX_MEMORY_MB \
282+
PUMA_MASTER_MAX_MEMORY_MB \
281283
GITLAB_INSTALL_DIR \
282284
GITLAB_INSTALL_DIR \
283285
PUMA_TIMEOUT \

0 commit comments

Comments
 (0)