diff --git a/config/puma.rb b/config/puma.rb index 402e41520..45d2745ae 100644 --- a/config/puma.rb +++ b/config/puma.rb @@ -32,3 +32,13 @@ threads 1, 1 before_fork do Process.warmup end + +# Defer major GC (full marking phase) until after request handling, +# and perform major GC deferred during request handling. +on_worker_boot do + GC.config(rgengc_allow_full_mark: false) +end + +out_of_band do + GC.start if GC.latest_gc_info(:need_major_by) +end