Commit d27224ceca2b1eb0644f593157e398193bd3e2dc
1 parent
4db2e97b
Exists in
master
and in
4 other branches
Add unicorn-worker-killer with memory check
Conflicts: Gemfile.lock
Showing
3 changed files
with
10 additions
and
0 deletions
Show diff stats
Gemfile
@@ -86,6 +86,7 @@ gem "asciidoctor" | @@ -86,6 +86,7 @@ gem "asciidoctor" | ||
86 | 86 | ||
87 | # Application server | 87 | # Application server |
88 | gem "unicorn", '~> 4.6.3', group: :unicorn | 88 | gem "unicorn", '~> 4.6.3', group: :unicorn |
89 | +gem 'unicorn-worker-killer', group: :unicorn | ||
89 | 90 | ||
90 | # State machine | 91 | # State machine |
91 | gem "state_machine" | 92 | gem "state_machine" |
Gemfile.lock
@@ -539,6 +539,8 @@ GEM | @@ -539,6 +539,8 @@ GEM | ||
539 | kgio (~> 2.6) | 539 | kgio (~> 2.6) |
540 | rack | 540 | rack |
541 | raindrops (~> 0.7) | 541 | raindrops (~> 0.7) |
542 | + unicorn-worker-killer (0.4.2) | ||
543 | + unicorn (~> 4) | ||
542 | virtus (1.0.1) | 544 | virtus (1.0.1) |
543 | axiom-types (~> 0.0.5) | 545 | axiom-types (~> 0.0.5) |
544 | coercible (~> 1.0) | 546 | coercible (~> 1.0) |
@@ -660,4 +662,5 @@ DEPENDENCIES | @@ -660,4 +662,5 @@ DEPENDENCIES | ||
660 | uglifier | 662 | uglifier |
661 | underscore-rails (~> 1.4.4) | 663 | underscore-rails (~> 1.4.4) |
662 | unicorn (~> 4.6.3) | 664 | unicorn (~> 4.6.3) |
665 | + unicorn-worker-killer | ||
663 | webmock | 666 | webmock |
config.ru
1 | # This file is used by Rack-based servers to start the application. | 1 | # This file is used by Rack-based servers to start the application. |
2 | 2 | ||
3 | +# Unicorn self-process killer | ||
4 | +require 'unicorn/worker_killer' | ||
5 | + | ||
6 | +# # Max memory size (RSS) per worker | ||
7 | +use Unicorn::WorkerKiller::Oom, (200 * (1 << 20)), (250 * (1 << 20)) | ||
8 | + | ||
3 | require ::File.expand_path('../config/environment', __FILE__) | 9 | require ::File.expand_path('../config/environment', __FILE__) |
4 | 10 | ||
5 | map ENV['RAILS_RELATIVE_URL_ROOT'] || "/" do | 11 | map ENV['RAILS_RELATIVE_URL_ROOT'] || "/" do |