Commit d27224ceca2b1eb0644f593157e398193bd3e2dc

Authored by Jacob Vosmaer
1 parent 4db2e97b

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 86  
87 87 # Application server
88 88 gem "unicorn", '~> 4.6.3', group: :unicorn
  89 +gem 'unicorn-worker-killer', group: :unicorn
89 90  
90 91 # State machine
91 92 gem "state_machine"
... ...
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
... ...