monitoring ruby app memory usage with passenger-recycler (was: Cannot require library for passenger in ruby)

Marcin Cieslak saper at saper.info
Tue Feb 20 21:31:25 UTC 2018


On Mon, 19 Feb 2018, Karli Sjöberg wrote:

> > What is the tool you are trying to deploy? foreman_maintain?

Sorry, I was too quick. This foreman_main is used to download/update foreman
from RedHat Satellite servers, which is not what you want.

However, the passenger-recycler script is a standalone script which
could possibly used with this little fix:

https://github.com/theforeman/foreman_maintain/pull/143

To apply this, please add files/patch-bin_passenger-recycler in the port I've sent before:

--- bin/passenger-recycler.orig 2018-02-20 21:09:18 UTC
+++ bin/passenger-recycler
@@ -41,10 +41,10 @@ def process_status?(pid)
 end
 
 require 'phusion_passenger'
+PhusionPassenger.locate_directories
 require 'phusion_passenger/platform_info'
 require 'phusion_passenger/platform_info/ruby'
 require 'phusion_passenger/admin_tools/memory_stats'
-PhusionPassenger.locate_directories
 stats = PhusionPassenger::AdminTools::MemoryStats.new
 unless stats.platform_provides_private_dirty_rss_information?
   puts 'Please run as root or platform unsupported'


But the real problem is that Passenger does think it supports
getting process private dirty RSS memory information only on Linux:

https://github.com/phusion/passenger/blob/219ad24159ae4033a342e6ad753cfee05d98bae0/src/ruby_supportlib/phusion_passenger/admin_tools/memory_stats.rb#L121

In file src/ruby_supportlib/phusion_passenger/admin_tools/memory_stats.rb:

120       def platform_provides_private_dirty_rss_information?
121         return os_name_simple == "linux"
122       end

This support probably would need to be written. So, unfortunately, passenger-recycler
as written will exit with:

	Please run as root or platform unsupported

But passenger-recycler does something very simple - if the amount of "private resident RSS
memory" is higher than specified amount in the configuration file, it kills the process.

You might get a much better monitoring on FreeBSD by monitoring the output of

procstat -v <processid>

which will give you details about the memory usage of the process and see how it is growing
over time. Maybe you can pinpoint the shared library that causes this, if you are lucky.

Marcin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 3663 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://lists.freebsd.org/pipermail/freebsd-ports/attachments/20180220/6b8a775f/attachment.bin>


More information about the freebsd-ports mailing list