Created
April 15, 2015 01:58
Revisions
-
mockdeep created this gist
Apr 15, 2015 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,18 @@ # config/puma.rb workers Integer(ENV['WEB_CONCURRENCY'] || 1) threads_count = Integer(ENV['MAX_THREADS'] || 2) threads threads_count, threads_count preload_app! rackup DefaultRackup port ENV['PORT'] || 3000 environment ENV['RACK_ENV'] || 'development' on_worker_boot do config = ActiveRecord::Base.configurations[Rails.env] config['reaping_frequency'] = ENV['DB_REAP_FREQ'] || 10 # seconds config['pool'] = ENV['DB_POOL'] || 20 ActiveRecord::Base.establish_connection(config) end This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,8 @@ # config/initializers/puma_worker_killer.rb PumaWorkerKiller.config do |config| config.ram = (ENV.fetch('PUMA_WORKER_KILLER_RAM') { 512 }).to_i config.frequency = (ENV.fetch('PUMA_WORKER_KILLER_FREQUENCY') { 10 }).to_i config.percent_usage = (ENV.fetch('PUMA_WORKER_KILLER_PERCENT') { 0.99 }).to_f end PumaWorkerKiller.start