[erlang-questions] SMP active?

Wallentin Dahlberg <>
Sun Aug 8 16:19:29 CEST 2010


There is obviously a serialization point somewhere in your test or some
other place underneath.
ETS is not single-threaded, it uses the same context as the calling process,
or rather it is the process and the corresponding thread. There are some
tweaks with ETS, I suggest you read-up on them, but in essence there is one
rw-lock per table and a namelookup lock (the metaname lock).

Since there is speculation on what the problem is you should use one of the
profilers provided in OTP. My favorite is the lock counter, lcnt, (though i
may be biased). The lock counter is not hard to use but you need some common
sense to interpret the results. You also need to recompile the vm (emulator
directory) with lcnt enabled. It has low cpu overhead but will consume a bit
of memory. lcnt will identify which locks give the most serialization, if it
is a process it will give you the registered name or pid. All locks in the
emulator are named (almost all are named with their purpose), and that will
give you an idea of whats going on.

Percept may also be useful but that one is a bit harder to interpret. Eprof
has low overhead (from R14A) and will tell you which functions take up the
most time, that is also helpful in identifying bad code.

// Björn-Egil

2010/8/6 Gardell, Steven <>

> Thanks.
>
> There are lots of processes overall (one per call ~20K), but I imagine
> that this is still the root problem. Duh. At the core I gather there is
> a single process responsible for dispatching incoming megaco requests
> back to my waiting Erlang process. Unfortunately this performance hit
> seems be quite dependant the number of current calls (as well, of
> course, as the call rate). I start seeing failures with an ets lookup
> being done by the stack. Since ets is, I gather, singly threaded, this
> might be as good as it gets without using multiple UDP ports and
> multiple megaco connection handlers. But depending on ets, even that
> might not help...
>
> -----Original Message-----
> From:  [mailto:]
> On Behalf Of Rapsey
> Sent: Friday, August 06, 2010 1:24 PM
> To: 
> Subject: Re: [erlang-questions] SMP active?
>
> If your test program only uses one process for the work that it does,
> erlang will only use up one process on the machine.
>
>
> Sergej
>
> On Fri, Aug 6, 2010 at 6:49 PM, Gardell, Steven
> <>wrote:
>
> > I am running Erlang on a 4 Core Dell machine:
> >
> > Linux xxx.sonusnet.com 2.6.9-55.ELsmp #1 SMP Fri Apr 20 16:36:54 EDT
> > 2007 x86_64 x86_64 x86_64 GNU/Linux
> >
> > Erlang R13B04 (erts-5.7.5) [source] [64-bit] [smp:4:4] [rq:4]
> > [async-threads:0] [hipe] [kernel-poll:false]
> >
> > When I run my Erlang program  (a Megaco test program), top shows only
> > only one of the cores being used to any meaningful level. Something
> > like (5%, 97%, 97%, 97%) idle. Push it harder and, not too
> > surprisingly, it starts presenting errors. I have tried the -smp and
> > -S options, but there is no change in behavior (which is consistent
> > with documentation, since smp should be enabled by default).
> >
> > Suggestions? Thanks!
> >
>
> ________________________________________________________________
> erlang-questions (at) erlang.org mailing list.
> See http://www.erlang.org/faq.html
> To unsubscribe; mailto:
>
>


More information about the erlang-questions mailing list