Design phase in Erlang

Jesper Wilhelmsson <>
Mon Dec 9 18:24:53 CET 2002


On Fri, 6 Dec 2002, Vance Shipley wrote:

<snip>

> $ erl +P 262144 +A 32 
> Erlang (BEAM) emulator version 5.2 [64-bit] [source] [threads:32]
> 
> 21> zog:start(180000).
> <0.23949.6>
> Setup : 5.17900 s (28.7724 us per spawn) (179999 spawns)
> Run   : 6.12400 s (5.67038 us per msg) (1079999 msgs)

I tried this in my shared heap system:
$ erl +P 262144 +A 32
Erlang (BEAM) emulator version 2002.10.12 [source] [shared heap]

Eshell V2002.10.12  (abort with ^G)
1> zog:start(180000).
<0.30.0>
Setup : 0.923000 s (5.12781 us per spawn) (179999 spawns)
Run   : 5.42400 s (5.02223 us per msg) (1079999 msgs)

I don't get quite the same numbers as you im my table (below). From the
looks of it, it seems we are using different programs. But I assure you, I
copied zog from the link you gave and ran it unmodified.
(I used a x86 for this, don't know if that makes any difference)

                  private                 shared
processes       spawn   mess            spawn   mess
10                0.0   1.5             0.0     0.9
100              20.2   1.5             0.0     0.9
1000             19.0   1.7             3.0     1.0
10000            34.6   1.8             3.6     1.3
20000            49.7   1.8             3.7     1.5
30000            64.8   1.9             3.7     1.5
40000            79.9   1.9             3.8     2.2
50000            94.9   1.8             3.7     2.7
60000           109.8   1.8             3.8     1.5
70000           125.2   1.9             4.9     2.7
80000           140.1   1.8             4.7     2.3
90000           155.8   1.9             4.6     5.2
100000          170.3   1.9             4.5     7.6
110000          185.7   1.9             4.5     8.1
120000          201.2   2.0             4.4     5.1
130000          215.7   1.9             5.6     2.2
140000          230.9   1.9             5.5    10.8
150000          246.3   1.9             5.4     2.8
160000          261.5   1.9             5.3    10.9
170000          277.1   1.8             5.2     1.5
180000          292.2   1.9             5.1     5.0
190000          307.3   1.9             6.4    15.5
200000          323.6   1.9             6.3    35.0

The program hardly sends any data, so the benefit of a shared heap is not
obvious here, only the (much) higher garbage collection latency.

Although this is interesting, an even more interesting table is:

                    private heap           shared heap
Pr    Words sent    allocated   used       allocated   used
10      1.753         78.012    56.584     139.104     9.497
100     1.933         98.982    56.584     139.104     9.497
1K      3.733        308.538    58.263     139.104     9.628
10K    21.733      2.405.682    76.215     139.104    27.628
20K    41.733      4.735.538    96.270     139.104    47.628
30K    61.733      7.065.538   116.292     139.104    67.628
40K    81.733      9.395.682   136.216     139.104    87.628
50K   101.733     11.725.682   156.216     139.104   107.628
60K   121.733     14.055.538   176.272     139.104   127.628
70K   141.733     16.385.538   196.302     139.104   128.784
80K   161.733     18.715.682   216.216     139.104   128.784
90K   181.733     21.045.682   236.257     139.104   128.784
100K  201.733     23.375.538   256.304     139.104   128.784
110K  221.733     25.705.682   276.184     139.104   128.784
120K  241.733     28.035.682   296.248     139.104   128.784
130K  261.733     30.365.682   316.303     139.104   128.785
140K  281.733     32.695.538   336.304     139.104   128.785
150K  301.733     35.025.682   356.185     139.104   128.785
160K  321.733     37.355.682   376.248     139.104   128.785
170K  341.733     39.685.682   396.303     139.104   128.785
180K  361.733     42.015.538   416.314     139.104   128.785
190K  381.733     44.345.682   436.191     139.104   128.841
200K  401.733     46.675.682   456.248     139.104   128.841

As you can see, the shared heap system was started with ~140K-word heap
(word = 4 bytes), and stayed there for the entire run.
"Heap" is in this case erlang process heap. Static system structures
(ets-tables, atom-tables etc) and PCBs are not included.
    __
___(  |_______________________  _______________________________________________
    | | ,---. ,--.,--.,--.   ( (
    | ||  _  || o ) o ) p )   ) ) "Beware of bugs in the above code;
    | || (_) || r'| r'| -×--.( (  I have only proved it correct, not tried it."
o,--' | `---' |_| |_| `-----' ) )                               -- Donald Knuth
_`----'______________________( (_______________________________________________
Jesper Wilhelmsson,                          +46 (0)18 471 1046
Computing Science Department, Uppsala University, Sweden     +46 (0)733 207 207
-------------------------------------------------------------------------------


> }  http://www.sics.se/~joe/ericsson/du98024.html
> 
> Just for fun I tried out this test on an UltraSparc 5 running
> Solaris 8 and R9B-0.  I found that it started paging at about
> 70K processes with 256MB of memory so I upgraded it to 512MB
> and found I could go to 180K processes before it paged.
> 
> 
> This is pretty is impressive!  What I found interesting are the 
> results of running the same tests using the shared heap emulator:
> 
>                 Non-shared Heap          Shared Heap
>                 (in micro secs)       (in micro secs)
>                -----------------      -----------------
> Processes      Spawn     Message      Spawn     Message
> ---------      -------  --------      ------   --------
>        10                    2.3                    2.1
>       100                    2.7        20.2        2.5
>      1000         29.0       2.8        29.0        2.8
>     10000         32.7       5.2        26.6        6.2
>     20000         31.0       5.2        27.2       10.4
>     30000         29.9       5.2        28.3       10.4
>     40000         29.4       5.3        29.3       26.8
>     50000         28.9       5.4        28.8       38.8
>     60000         28.6       5.4        38.0       10.4
>     70000         29.3       5.4        36.6       38.9
>     80000         29.3       5.3        35.7       26.9
>     90000         29.3       5.5        38.0        9.8
>    100000         29.0       5.6        33.5      134.6
>    110000         29.0       5.6        33.4      134.6
>    120000         29.1       5.6        33.3       89.6
>    130000         28.1       5.4        41.7       27.0
>    140000         28.6       5.8        40.8      188.2
>    150000         28.5       5.5        40.0       39.0
>    160000         28.5       5.8        39.3      188.2
>    170000         28.7       5.3        38.7  *    13.7
>    180000         28.8       5.7        42.3  *   121.4
>    190000         43.3  *   86.7       579.4  *   328.1
>    200000         42.7  *  233.1          
> 
>   [*] paging
> 



More information about the erlang-questions mailing list