diff --git a/Gemfile b/Gemfile index 5b28b76..13d4a20 100644 --- a/Gemfile +++ b/Gemfile @@ -61,6 +61,7 @@ group :test do end group :production do - gem 'unicorn', '~> 4.7' - gem 'dalli', '~> 2.6.2' + gem 'unicorn', '~> 4.7' + gem 'dalli', '~> 2.6.2' + gem 'unicorn-worker-killer', '~> 0.4.2' end diff --git a/Gemfile.lock b/Gemfile.lock index c4a302b..c76c6bb 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -316,6 +316,8 @@ GEM kgio (~> 2.6) rack raindrops (~> 0.7) + unicorn-worker-killer (0.4.2) + unicorn (~> 4) virtus (1.0.1) axiom-types (~> 0.0.5) coercible (~> 1.0) @@ -378,5 +380,6 @@ DEPENDENCIES thin (~> 1.5.0) uglifier (>= 2.3.1) unicorn (~> 4.7) + unicorn-worker-killer (~> 0.4.2) virtus (~> 1.0.1) yajl-ruby (~> 1.1.0) diff --git a/config.ru b/config.ru index efd6b8d..321f1ff 100644 --- a/config.ru +++ b/config.ru @@ -1,5 +1,8 @@ # This file is used by Rack-based servers to start the application. +require 'unicorn/worker_killer' +use Unicorn::WorkerKiller::Oom, (160*(1024**2)), (180*(1024**2)) + require ::File.expand_path('../config/environment', __FILE__) use Rack::Deflater