diff --git a/config/puma.rb b/config/puma.rb index 45d2745ae..60b371210 100644 --- a/config/puma.rb +++ b/config/puma.rb @@ -17,28 +17,30 @@ activate_control_app control_uri, no_token: true plugin :yabeda plugin :yabeda_prometheus -# Because we expect fewer I/O waits than Rails apps that connect to the -# database over the network, let's start with a baseline config of 1 -# worker per CPU, 1 thread per worker and tune it from there. -# -# https://edgeguides.rubyonrails.org/tuning_performance_for_deployment.html#puma -workers Concurrent.physical_processor_count -threads 1, 1 +if !Rails.env.local? + # Because we expect fewer I/O waits than Rails apps that connect to the + # database over the network, let's start with a baseline config of 1 + # worker per CPU, 1 thread per worker and tune it from there. + # + # https://edgeguides.rubyonrails.org/tuning_performance_for_deployment.html#puma + workers Concurrent.physical_processor_count + threads 1, 1 -# Tell the Ruby VM that we're finished booting up. -# -# Now's the time to tidy the heap (GC, compact, free empty, malloc_trim, etc) -# for optimal copy-on-write efficiency. -before_fork do - Process.warmup -end + # Tell the Ruby VM that we're finished booting up. + # + # Now's the time to tidy the heap (GC, compact, free empty, malloc_trim, etc) + # for optimal copy-on-write efficiency. + 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 + # Defer major GC (full marking phase) until after request handling, + # and perform major GC deferred during request handling. + before_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) + out_of_band do + GC.start if GC.latest_gc_info(:need_major_by) + end end