[erlang-questions] How to use dbg and fprof to profile a running server ?

Björn-Egil Dahlberg <>
Thu Aug 30 17:54:19 CEST 2012

On 2012-08-30 17:25, Jesper Louis Andersen wrote:
> On Aug 28, 2012, at 11:17 AM, Bo Chen <> wrote:
>> Hello, every one,
>>              I am a rookie in erlang. Recently I am trying to use the dbg and fprof module to profile a running server to observe the performance. Since the server is based on mochiweb, a quite popular web server framework, and I only wish to see the performance of my own code, I tried the dbg module. I have tried in the following two ways:
> I would look into eprof first. It will give you profile outputs in the "large" and when you then know where the time is spent I would target that area with fprof. Also, if you are running on multicore, don't skip the thought that you may have to do lock count profiling as well.
> For your own code, I would set up a typical test case and then use that as the profile basis for fprof.
I agree with Jesper. Start with eprof to get a feeling for what might be 
Also eprof can handle a much higher load than fprof can, i.e. eprof is a 
magnitude or two faster.

The lock counter, lcnt, can also handle relative high loads. It can also 
dismiss some results thus saving some memory and performance. lcnt can 
also be used to see msg-queue locks on erlang processes, thus useful to 
profile erlang application and not just to tweak the runtime.

// Björn-Egil

More information about the erlang-questions mailing list