Created
June 2, 2015 12:17
-
-
Save johnl/4c7e51b8bc20ee4bf07e to your computer and use it in GitHub Desktop.
Hacky patch to unicorn to log process ram use after each request
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Unicorn::HttpServer | |
alias process_client_orig process_client | |
undef_method :process_client | |
def process_client(client) | |
process_client_orig(client) | |
rss = `ps -o rss= -p #{Process.pid}`.chomp.to_i / 1024 | |
puts "Unicorn #{Process.pid}, #{request.env['REQUEST_METHOD']} #{request.env['REQUEST_PATH']} using #{rss}M" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment