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
Gemfile.lock
| ... | ... | @@ -539,6 +539,8 @@ GEM |
| 539 | 539 | kgio (~> 2.6) |
| 540 | 540 | rack |
| 541 | 541 | raindrops (~> 0.7) |
| 542 | + unicorn-worker-killer (0.4.2) | |
| 543 | + unicorn (~> 4) | |
| 542 | 544 | virtus (1.0.1) |
| 543 | 545 | axiom-types (~> 0.0.5) |
| 544 | 546 | coercible (~> 1.0) |
| ... | ... | @@ -660,4 +662,5 @@ DEPENDENCIES |
| 660 | 662 | uglifier |
| 661 | 663 | underscore-rails (~> 1.4.4) |
| 662 | 664 | unicorn (~> 4.6.3) |
| 665 | + unicorn-worker-killer | |
| 663 | 666 | webmock | ... | ... |
config.ru
| 1 | 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 | 9 | require ::File.expand_path('../config/environment', __FILE__) |
| 4 | 10 | |
| 5 | 11 | map ENV['RAILS_RELATIVE_URL_ROOT'] || "/" do | ... | ... |