memory - Creating a separate log for each Passenger process in a Rails app -
i'm trying determine cause of high app server instance memory usage , need separate log each running passenger process (e.g., production_18204.log). there simple way configure in rails app? thanks.
to log memory used process in each request use following code.
def log_memory_usage mem_usage = `ps -o rss= -p #{ process.pid }`.to_i if logger logger.info("[memory usage]: #{ number_to_human_size(mem_usage) } | pid: #{ process.pid } | controller: #{ controller_name } | action: #{ action_name }") end end
use before action in base or application controller. include actionview::helpers::numberhelper
make number_to_human_size
work.
Comments
Post a Comment