How do you profile memory in Elixir/Phoenix?

Is the below from aldusleaf the best way to monitor memory in Elixir/Phoenix (both on production and locally) in 2016?

http://aldusleaf.org/monitoring-elixir-apps-in-2016-prometheus-and-grafana/

I was looking for something like https://github.com/SamSaffron/memory_profiler in Ruby as well if anyone knows if there’s such a tool for Elixir.

I’ve googled around and found some cobbled together erlang scripts (along w/fprof, which doesn’t do memory if I read it right).

2 Likes

That looks like a real-time library rather than reporting, and if that is what you want then is there anything wrong with :observer.start() (run that in your iex session of the server) that is built-in with erlang or any of the other built-in functionalities?

1 Like

Observer is the tool I reach for most of the time. IIRC, there were also some useful tips in Erlang in Anger. The recon library by the author might also help.

4 Likes

The methods of accessing internal state by the tools mentioned like observer and recon are all well defined and open. They don’t have any special privileges. This means that you can write your own specific tools if you need to.

3 Likes

Absolutely! This big sense of a bottom up design is one of my favourite things about Erlang.

1 Like

Ok, thank you all for your replies. Being pretty new to Elixir, I had a version of Erlang that didn’t have the “wxwidgets” baked in so :observer.start() wouldn’t run. But I solved that now and managed to get a handle on the memory issues…I’m looking forward to learning more about the Elixir / Erlang ecosystem.

2 Likes