How to make the Erlang VM predictible when spawning processes?

Ovidiu Deac <>
Thu Jun 3 20:00:29 CEST 2010

Hello everybody,

I'm doing some research in order to figure out if Erlang is suitable
for an application that we need to implement.

In a few words it's about a server which has a requirement saying "no
request should take more then 10ms"', measured on the client's

So I started a couple of tests for various erlang components to figure
out how much some operations would take. Partly because I wanted to
get some figures and partly to exercise my Erlang skills.

First I wrote a profiler module which can measure the execution time
for various modules which implement set_up,tear_down and test_main.
Also this profiler can repeat a test a number of times and returns a
list with all the execution times, the minimum, the maximum and the
average time. Nothing fancy.

See the attachment for the profiler code and I post below some results
for a test that I ran on a machine with Intel Core2 Duo/Win7/erlang
v5.7.5. One test consists in 1000 spawns and is repeated 100 times.
The times displayed are microseconds.

$ make -C .. && erl +P 200000 -noshell -s profiler run spawn_test 100
silent 0 1000 -s init stop
make: Entering directory `/cygdrive/d/work/erlang/finn'
make: Leaving directory `/cygdrive/d/work/erlang/finn'
Module to test:spawn_test, Repeats:100, Params=[silent,'0','1000']
Times elapsed = [1,15998,1,1,1,1,14991,1,1,1,1,15991,1,1,1,1,15991,1,1,1,1,
Max us/execution=15998
Min us/execution=1
Average us/execution=3279.01

The average time for spawning a process is around 3us which is very
good. It's interesting to see that spawning 1000 processes took
1microsecond (!!!) Looks like some bug it the profiler. Also my main
concern is that from time to time spawning a process takes around 15ms
which is way too much.

I tried to run erl +P 200000 but the behaviour is the same as without
this parameter.

Do you have any idea how to make the VM predictible in order to
satisfy the 10ms requirement?

Thanks in advance,
-------------- next part --------------
A non-text attachment was scrubbed...
Name: profiler.erl
Type: application/octet-stream
Size: 1420 bytes
Desc: not available
URL: <>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: spawn_test.erl
Type: application/octet-stream
Size: 1236 bytes
Desc: not available
URL: <>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: tools.erl
Type: application/octet-stream
Size: 236 bytes
Desc: not available
URL: <>

More information about the erlang-questions mailing list