From 1b156f9cda5f824c886c645266ab85891a4e8cef Mon Sep 17 00:00:00 2001 From: Brian Austin <13002992+brianjaustin@users.noreply.github.com> Date: Wed, 29 Jan 2025 01:05:47 -0500 Subject: [PATCH] AO3-6890 Add puma worker killer gem (#5038) * AO3-6890 Add puma worker killer gem * Remove initializer (it will be configured in Ansible) --- Gemfile | 1 + Gemfile.lock | 8 ++++++++ config/config.yml | 5 +++++ 3 files changed, 14 insertions(+) diff --git a/Gemfile b/Gemfile index 893150984cc..d7ca8502b3b 100644 --- a/Gemfile +++ b/Gemfile @@ -111,6 +111,7 @@ gem "marcel", "1.0.2" gem "departure", "~> 6.5" gem "rack-timeout" +gem "puma_worker_killer" group :test do gem "rspec-rails", "~> 6.0" diff --git a/Gemfile.lock b/Gemfile.lock index f4e6256f094..d354f0821ce 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -296,6 +296,9 @@ GEM fugit (1.11.1) et-orbi (~> 1, >= 1.2.11) raabro (~> 1.4) + get_process_mem (1.0.0) + bigdecimal (>= 2.0) + ffi (~> 1.0) globalid (1.2.1) activesupport (>= 6.1) god (0.13.7) @@ -423,6 +426,10 @@ GEM public_suffix (5.0.4) puma (6.5.0) nio4r (~> 2.0) + puma_worker_killer (1.0.0) + bigdecimal (>= 2.0) + get_process_mem (>= 0.2) + puma (>= 2.7) pundit (2.3.1) activesupport (>= 3.0.0) raabro (1.4.0) @@ -699,6 +706,7 @@ DEPENDENCIES pickle pry-byebug puma (~> 6.5.0) + puma_worker_killer pundit rack (~> 2.2) rack-attack diff --git a/config/config.yml b/config/config.yml index f93e615ec07..a5f022b7056 100644 --- a/config/config.yml +++ b/config/config.yml @@ -746,3 +746,8 @@ PERCONA_ARGS: > # Production has more than 5 for these BOOKMARKABLE_SHARDS: 5 WORKS_SHARDS: 5 + +# Puma killer config (automatically restart Puma when resource constrained); +# both are measured in seconds. +PUMA_ROLLING_RESTART_FREQUENCY: 172800 # 2 days +PUMA_ROLLING_RESTART_SPLAY: 702