From 95d395343bd0a3149b753324ce304079200a554b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javi=20Mart=C3=ADn?= Date: Mon, 11 Nov 2019 19:56:19 +0100 Subject: [PATCH] Use two puma workers This is the same configuration we had with unicorn. With several workers, we've got two basic configuration options: * Preload the application and use a hot restart * Don't preload the application and use a phased restart I've decided to preload the application because using a hot restart changes are available immediately, while with a phased restart there are a few seconds when both workers for the old code and workers for the new code exist. Using a phased restart also has advantages, so some forks might want to disable the `puma_preload_app` setting in order to use it. --- config/deploy.rb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/config/deploy.rb b/config/deploy.rb index c1859054f..b3037b6e6 100644 --- a/config/deploy.rb +++ b/config/deploy.rb @@ -29,6 +29,9 @@ set :keep_releases, 5 set :local_user, ENV["USER"] set :puma_restart_command, "bundle exec --keep-file-descriptors puma" +set :puma_workers, 2 +set :puma_preload_app, true +set :puma_init_active_record, true set :delayed_job_workers, 2 set :delayed_job_roles, :background