0.0
Repository is archived
No commit activity in last 3 years
No release in over 3 years
Rack::OOMKiller is a rack middleware that will check the memory usage of the process post-request, and if > 400mb exit
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.0
~> 1.2.0
 Project Readme

Rack OOM Killer

Post-request, will check the memory usage of the process and if it exceeds the configured amount (default 350m), exit. Try and exit nicely initially, after 10 seconds kill the process

Usage

Rails 3.x:

Gemfile:

gem "rack_oom_killer"

In application.rb

# max_mem optional
config.middleware.use = Rack::OOMKiller, :max_mem => 200

Sinatra:

Require and load gem as appropriate

# max_mem is optional
use Rack::OOMKiller, :max_mem => 200

Caveats

Note, this executes after the request has been processed - if a single request blows out the memory usage too much, this isn't going to handle that.

Only tested on Linux and Mac. Highly unlikely to work on Windows.