tsonntag

tsonntag

How to profile phx.server?

I spent hours to find out how to profile phx.server (in dev). Without success.
I am looking for something link (pseudo code)
“mix with eprof run phx.server”
or something equivalent in iex
or some hook in the application code

Most Liked

thiagomajesk

thiagomajesk

This is a pretty old thread, but I wonder if anyone has tried something like this recently. I’m trying to profile a Phoenix app and I feel this should be easier. Here’s what I tried so far:

  • iex -S mix phx.server
  • :eprof.start_profiling([self()])
  • Test the application
  • :eprof.stop_profiling()
  • :eprof.analyze(:total)

However, eprof does not log anything from the app itself. Using fprof though, I can get some calls to the application, but the summary format you get is pretty wild:

  • iex -S mix phx.server
  • :fprof.start()
  • :fprof.trace([:start, procs: :all])
  • Test the application
  • :fprof.trace(:stop)
  • :fprof.profile()
  • :fprof.analyse(:totals)
NobbZ

NobbZ

You usually do not profile the running server. That would in best case only give you a profile of the connection acceptor, but not the spawned processes that actually handle the request.

You need to profile the actual controllers or views you are interested in.

Where Next?

Popular in Questions Top

vonH
In asking this question I am more interested about the expressiveness of the language itself and less concerned about the availability of...
New
openscript
Hello! Sorry for this astonishing simple question, but I’m really stuck. I try to set up the intellij-elixir plugin, but I don’t know ho...
New
PeterCarter
There are pre-rolled solutions for other frameworks that do work. However, Phoenix does not seem to have these. Have people had good expe...
New
joeerl
Hello again - after a longish gap I’ve decided I really must dig into Elixir and see what’s been happening here - so I have a few questio...
New
albydarned
Hello all! I am typing this post from my new MacBook Pro with the M1 chip. I’m loving it so far, and will probably use it as my daily dr...
New
SoCreat
i’m a new one to elixir which editor can i use vs code? or atom? Thanks! :smiley:
New
dblack
I’ve got an issue with an app and I’ve no idea of how to troubleshoot it. I’m hoping someone here might have seen something similar. I p...
New

Other popular topics Top

vertexbuffer
Hello, can anybody help here..? I have a list of players and I what to delete an element, but every for loop the list is reverting to ori...
New
jononomo
I am trying to figure out how Mix knows whether the environment is test, dev, or prod – where is this set? Thanks.
New
stefanchrobot
What’s the safe way to decode a JSON string into a struct? I want to avoid calling String.to_atom. Jason.decode can give me a map with st...
New
greenz1
I have a phoenix application from which a user can download multiple(5-6) files of size 1MB. I couldn’t find anything related to sending ...
New
sorentwo
Hello! tl;dr Announcing Oban, an Ecto based job processing library with a focus on reliability and historical observability. After spen...
985 44778 311
New
WestKeys
Currently suffering from paralysis by [HTTP client] analysis. This is rather unusual in Elixirland as there tends to be consensus on the ...
New

We're in Beta

About us Mission Statement