From eeb4632d68b5974ceda35853bdc3078f05cc1aee Mon Sep 17 00:00:00 2001 From: Theo Chatzimichos Date: Sat, 8 Apr 2017 20:01:18 +0200 Subject: [PATCH] add optional support for unicorn-worker-killer in config.ru --- templates/config.ru/99-run-3.0.erb | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/templates/config.ru/99-run-3.0.erb b/templates/config.ru/99-run-3.0.erb index 5e43c19..cb913ea 100644 --- a/templates/config.ru/99-run-3.0.erb +++ b/templates/config.ru/99-run-3.0.erb @@ -17,6 +17,21 @@ ARGV << "--color" << "false" ARGV << "--confdir" << "<%= @puppet_confdir %>" ARGV << "--vardir" << "<%= @puppet_vardir %>" +begin + require 'unicorn/worker_killer' + + max_request_min = 500 + max_request_max = 600 + + use Unicorn::WorkerKiller::MaxRequests, max_request_min, max_request_max + + oom_min = (240) * (1024**2) + oom_max = (260) * (1024**2) + + use Unicorn::WorkerKiller::Oom, oom_min, oom_max +rescue LoadError +end + # NOTE: it's unfortunate that we have to use the "CommandLine" class # here to launch the app, but it contains some initialization logic # (such as triggering the parsing of the config file) that is very