zombocom / puma_worker_killer

Automatically restart Puma cluster workers based on max RAM available
748 stars 77 forks source link

Add puma worker killer config into puma config file, rather than into initializers #19

Closed raymondmars closed 8 years ago

raymondmars commented 8 years ago

Add puma worker killer config into puma config file when you start puma as a daemon. If you add it into initialize file , it could be problem. Sample like this: (in puma.rb file) before_fork do ActiveRecord::Base.connection_pool.disconnect!

PumaWorkerKiller.config do |config| config.ram = 2 * 1024 # mb config.frequency = 10 # seconds config.percent_usage = 0.95 config.rolling_restart_frequency = 12 * 3600 # 12 hours in seconds end PumaWorkerKiller.start end