Hello,
I wrote a small utility that can attach to Foreman or Foreman Proxy
and start tracing ruby calls, count objects, arrays, hashes and method
calls in top-like experience without restarting the application. This
has been tested on CentOS7 with TFM Ruby Software Collections but with
some changes the script should run on any linux OS with modern kernel.
https://github.com/lzap/foreman-tracer (If you like it, you know where
is the star button!)
It's a great tool for debugging production or even development
deployments, either performance or memory bottlenecks can be spotted
quite easily. You need to have enough columns and rows in your
terminal as it does not detect it and text can easily break. If you
want to see it live, watch today's demo:
There were some requests to include this with Foreman or
foreman-cli-admin. I am not doing this for now, but send me your
patches and we will see. The script was written in a dirty way (copy
pasting some portions), it needs more love. Send me your success
stories and if I see enough of them, I can turn this into properly
packaged tool with nicer interface and features.
But it is still valuable tool that can help. Last two releases we had
couple of performance issues here and there, this is the reason why I
came up with this. If you want to read something more about SystemTap
and Ruby, go here:
https://lukas.zapletalovi.com/2016/08/probing-ruby-20-apps-with-systemtap-in-rhel7.html
The article basically explains what foreman-tracer does under the hood.