[erlang-questions] latency of smp vs non-smp + optimizing throughput

Joel Reymont <>
Mon Oct 6 14:36:33 CEST 2008


I seem to do much better running 3 non-SMP VMs (-smp disable) on my  
Mac, at least 500 games run to completion without any drastic  
increases in latency.

SMP vs non-SMP stats are at the bottom of this email but briefly  
looking at the last statistics dump:

SMP disabled:

     {time_to_client,avg}: 224.20649573953042
     {time_to_server,avg}: 71.4781241171356

SMP enabled:

     {time_to_client,avg}: 3586.21374521735
     {time_to_server,avg}: 0.345146548308556

I thought that the increase in outgoing latency is due to the sheer  
amount of data that I'm pumping out. For example, every 10 seconds I  
get this much data in

     bytes_in: 793628
     {bytes_in,per_sec}: 79362

     packets_in: 32108
     {packets_in,per_sec}: 3210

which gives decent incoming latency

     {time_to_server,min}: 23.144
     {time_to_server,avg}: 71.4781241171356
     {time_to_server,max}: 488.238

I'm pumping out almost as much data, though

     bytes_out: 778418
     {bytes_out,per_sec}: 77841

but in twice as many packets.

     packets_out: 63074
     {packets_out,per_sec}: 6307

This gives me a much higher outgoing latency that I'm still scratching  
my head over.

     {time_to_client,min}: 34.8
     {time_to_client,avg}: 224.20649573953042
     {time_to_client,max}: 2599.91

Any suggestions on how to optimize this?

	Thanks, Joel


--- SMP disabled ---

Erlang (BEAM) emulator version 5.6.3 [source] [64-bit] [async-threads: 
0] [kernel-poll:true]

()2> dmb:test(500).
gateway:start('', 4000, 500000)
Waiting for game servers...
Starting a port server on 4000...
Simulating gameplay with 500 games...
50 games started, 262 players
100 games started, 504 players
150 games started, 743 players
200 games started, 1019 players
250 games started, 1288 players
300 games started, 1529 players
350 games started, 1766 players
400 games started, 2057 players
450 games started, 2304 players
500 games started, 2562 players
dmb: 500 games launching simultaneously
dmb: waiting for games to end...

=INFO REPORT==== 6-Oct-2008::13:21:03 ===
     module: stats
     elapsed: 10.000171
     bytes_in: 146366
     bytes_out: 46116
     packets_in: 8186
     packets_out: 5124
     {bytes_in,per_sec}: 14636
     {bytes_out,per_sec}: 4611
     {packets_in,per_sec}: 818
     {packets_out,per_sec}: 512
     {time_to_client,min}: 0.39
     {time_to_server,min}: 0.053
     {time_to_client,max}: 4.65
     {time_to_server,max}: 3.243
     {time_to_client,avg}: 0.7572145936482696
     {time_to_server,avg}: 0.2872718335693714

=INFO REPORT==== 6-Oct-2008::13:21:13 ===
     module: stats
     elapsed: 10.000046
     bytes_in: 113721
     bytes_out: 446136
     packets_in: 4797
     packets_out: 30062
     {bytes_in,per_sec}: 11372
     {bytes_out,per_sec}: 44613
     {packets_in,per_sec}: 479
     {packets_out,per_sec}: 3006
     {time_to_client,min}: 0.29
     {time_to_server,min}: 0.085
     {time_to_client,max}: 31.137
     {time_to_server,max}: 37.724
     {time_to_client,avg}: 17.673999912193082
     {time_to_server,avg}: 9.69423139935136

=INFO REPORT==== 6-Oct-2008::13:21:23 ===
     module: stats
     elapsed: 9.999948
     bytes_in: 486797
     bytes_out: 220674
     packets_in: 20351
     packets_out: 15110
     {bytes_in,per_sec}: 48679
     {bytes_out,per_sec}: 22067
     {packets_in,per_sec}: 2035
     {packets_out,per_sec}: 1511
     {time_to_client,min}: 0.466
     {time_to_server,min}: 1.573
     {time_to_client,max}: 39.079
     {time_to_server,max}: 61.043
     {time_to_client,avg}: 0.9661870246546748
     {time_to_server,avg}: 1.7370862806690366

=INFO REPORT==== 6-Oct-2008::13:21:33 ===
     module: stats
     elapsed: 10.000047
     bytes_in: 42489
     bytes_out: 1827059
     packets_in: 1713
     packets_out: 148182
     {bytes_in,per_sec}: 4248
     {bytes_out,per_sec}: 182705
     {packets_in,per_sec}: 171
     {packets_out,per_sec}: 14818
     {time_to_client,min}: 0.241
     {time_to_server,min}: 0.063
     {time_to_client,max}: 216.895
     {time_to_server,max}: 35.445
     {time_to_client,avg}: 90.84005908047558
     {time_to_server,avg}: 9.594852014216947

=INFO REPORT==== 6-Oct-2008::13:21:43 ===
     module: stats
     elapsed: 9.999926
     bytes_in: 186974
     bytes_out: 1309921
     packets_in: 7550
     packets_out: 109166
     {bytes_in,per_sec}: 18697
     {bytes_out,per_sec}: 130993
     {packets_in,per_sec}: 755
     {packets_out,per_sec}: 10916
     {time_to_client,min}: 13.339
     {time_to_server,min}: 4.094
     {time_to_client,max}: 548.193
     {time_to_server,max}: 168.099
     {time_to_client,avg}: 257.6465068927692
     {time_to_server,avg}: 40.70231906170637
dmb: exited successfully, 53.110242 seconds elapsed
ok
()3> halt().
=INFO REPORT==== 6-Oct-2008::13:21:53 ===
     module: stats
     elapsed: 10.000018
     bytes_in: 793628
     bytes_out: 778418
     packets_in: 32108
     packets_out: 63074
     {bytes_in,per_sec}: 79362
     {bytes_out,per_sec}: 77841
     {packets_in,per_sec}: 3210
     {packets_out,per_sec}: 6307
     {time_to_client,min}: 34.8
     {time_to_server,min}: 23.144
     {time_to_client,max}: 2599.91
     {time_to_server,max}: 488.238
     {time_to_client,avg}: 224.20649573953042
     {time_to_server,avg}: 71.4781241171356

--- SMP enabled ---

Doesn't run through and is made to crash on a timeout.

Erlang (BEAM) emulator version 5.6.3 [source] [64-bit] [smp:8] [async- 
threads:0] [kernel-poll:true]

()2> dmb:test(500).
gateway:start('', 4000, 500000)
Waiting for game servers...
Starting a port server on 4000...
Simulating gameplay with 500 games...
50 games started, 262 players
100 games started, 504 players
150 games started, 743 players
200 games started, 1019 players
250 games started, 1288 players
300 games started, 1529 players
350 games started, 1766 players
400 games started, 2057 players
450 games started, 2304 players
500 games started, 2562 players
dmb: 500 games launching simultaneously
dmb: waiting for games to end...

=INFO REPORT==== 6-Oct-2008::13:26:56 ===
     module: stats
     elapsed: 10.001047
     bytes_in: 129677
     bytes_out: 40914
     packets_in: 7252
     packets_out: 4546
     {bytes_in,per_sec}: 12966
     {bytes_out,per_sec}: 4090
     {packets_in,per_sec}: 725
     {packets_out,per_sec}: 454
     {time_to_client,min}: 0.479
     {time_to_server,min}: 0.064
     {time_to_client,max}: 2.798
     {time_to_server,max}: 2.383
     {time_to_client,avg}: 1.0302147870344318
     {time_to_server,avg}: 1.0730058206685198

=INFO REPORT==== 6-Oct-2008::13:27:06 ===
     module: stats
     elapsed: 9.999979
     bytes_in: 73372
     bytes_out: 119961
     packets_in: 3343
     packets_out: 8176
     {bytes_in,per_sec}: 7337
     {bytes_out,per_sec}: 11996
     {packets_in,per_sec}: 334
     {packets_out,per_sec}: 817
     {time_to_client,min}: 0.556
     {time_to_server,min}: 0.067
     {time_to_client,max}: 207.146
     {time_to_server,max}: 60.546
     {time_to_client,avg}: 114.43896301514758
     {time_to_server,avg}: 0.8372796687202076

=INFO REPORT==== 6-Oct-2008::13:27:16 ===
     module: stats
     elapsed: 9.998979
     bytes_in: 543835
     bytes_out: 552051
     packets_in: 22739
     packets_out: 37574
     {bytes_in,per_sec}: 54389
     {bytes_out,per_sec}: 55210
     {packets_in,per_sec}: 2274
     {packets_out,per_sec}: 3757
     {time_to_client,min}: 26.731
     {time_to_server,min}: 0.067
     {time_to_client,max}: 2600.522
     {time_to_server,max}: 430.95
     {time_to_client,avg}: 281.00073907216733
     {time_to_server,avg}: 0.7417702616026968

=INFO REPORT==== 6-Oct-2008::13:27:26 ===
     module: stats
     elapsed: 10.00179
     bytes_in: 333568
     bytes_out: 1035862
     packets_in: 13460
     packets_out: 81032
     {bytes_in,per_sec}: 33350
     {bytes_out,per_sec}: 103567
     {packets_in,per_sec}: 1345
     {packets_out,per_sec}: 8101
     {time_to_client,min}: 0.979
     {time_to_server,min}: 0.069
     {time_to_client,max}: 3687.48
     {time_to_server,max}: 596.026
     {time_to_client,avg}: 622.5489355064024
     {time_to_server,avg}: 1.83386123075884
** exception error: no case clause matching noconnection
      in function  dmb:wait_for_games/1
()3>
=INFO REPORT==== 6-Oct-2008::13:27:36 ===
     module: stats
     elapsed: 9.998224
     bytes_in: 153581
     bytes_out: 99958
     packets_in: 6205
     packets_out: 8446
     {bytes_in,per_sec}: 15360
     {bytes_out,per_sec}: 9997
     {packets_in,per_sec}: 620
     {packets_out,per_sec}: 844
     {time_to_client,min}: 298.654
     {time_to_server,min}: 0.078
     {time_to_client,max}: 5431.219
     {time_to_server,max}: 794.497
     {time_to_client,avg}: 3586.21374521735
     {time_to_server,avg}: 0.345146548308556



---
http://wagerlabs.com




More information about the erlang-questions mailing list