[erlang-questions] Re: Unicast 20k messages, $500-$1000 bounty

Cliff Moon <>
Thu Jul 16 21:29:53 CEST 2009


Word dogg.  On my ec2 cluster (2 machines, small instance) I'm pretty 
consistently getting under 2 seconds:

()1> bot:test(flashbot, 
20000, "domU-12-31-39-02-B5-46.compute-1.internal", 8081).
publishing

=INFO REPORT==== 16-Jul-2009::14:34:42 ===
setup: 77401.66ms, good: 20000, bad: 0, run: 13670.42ms
  590.9040ms | min  
  500.0000ms | 0      -   0.00%
 1000.0000ms | 3553   -  17.77%
 1500.0000ms | 8093   -  40.47%
 2000.0000ms | 8354   -  41.77%
 1861.2000ms | max  
ok
()2> bot:test(flashbot, 
20000, "domU-12-31-39-02-B5-46.compute-1.internal", 8081).
publishing

=INFO REPORT==== 16-Jul-2009::14:36:32 ===
setup: 79961.47ms, good: 20000, bad: 0, run: 13641.45ms
  459.8880ms | min  
  500.0000ms | 424    -   2.12%
 1000.0000ms | 4116   -  20.58%
 1500.0000ms | 7236   -  36.18%
 2000.0000ms | 8224   -  41.12%
 1760.0160ms | max  
ok

The code is here: http://github.com/cliffmoon/janus

I'll have a write up a little later that has the optimizations which 
seem to matter most.

Joel Reymont wrote:
>
> On Jul 16, 2009, at 6:18 PM, Cliff Moon wrote:
>
>> The problem you're seeing there is process scheduling overhead.  In 
>> the fun it sends a message and it's doing an ungodly amount of 
>> context switching.  The way to get around this is to bump the process 
>> priority level of the process which iterates the ets table.
>
>
> bumping priority to high before the broadcasting list comprehension 
> and lowering it after results in ~10ms broadcasting time and shaves 
> ~300ms off max latency. Loving it!
>
> Mac is at ~2s (one box for everything) and ec2 is ~2.7s when bots are 
> spread over 3 instances. It looks like process priority is a very 
> useful tool in one's toolbox.
>
> ()4> bot:test(flashbot, 20000, 
> 'ip-10-244-47-97', 8081).
>
> =INFO REPORT==== 16-Jul-2009::19:05:18 ===
> setup: 69312.72ms, good: 20000, bad: 0, run: 72269.01ms
>   315.0020ms | min
>   500.0000ms | 2019   -  10.10%
>  1000.0000ms | 3651   -  18.25%
>  1500.0000ms | 4433   -  22.17%
>  2000.0000ms | 5259   -  26.30%
>  2500.0000ms | 4057   -  20.29%
>  3000.0000ms | 581    -   2.90%
>  2713.3960ms | max
> ok
> ()5> bot:test(flashbot, 20000, 
> 'ip-10-244-47-97', 8081).
>
> =INFO REPORT==== 16-Jul-2009::19:08:37 ===
> setup: 65606.03ms, good: 20000, bad: 0, run: 68362.39ms
>   328.4420ms | min
>   500.0000ms | 1361   -   6.80%
>  1000.0000ms | 4231   -  21.15%
>  1500.0000ms | 4477   -  22.38%
>  2000.0000ms | 4490   -  22.45%
>  2500.0000ms | 4051   -  20.26%
>  3000.0000ms | 1390   -   6.95%
>  2716.1440ms | max
> ok
> ()6> bot:test(flashbot, 20000, 
> 'ip-10-244-47-97', 8081).
>
> =INFO REPORT==== 16-Jul-2009::19:10:45 ===
> setup: 99778.01ms, good: 19953, bad: 47, run: 104700.73ms
>   313.9300ms | min
>   500.0000ms | 1420   -   7.12%
>  1000.0000ms | 4553   -  22.82%
>  1500.0000ms | 3987   -  19.98%
>  2000.0000ms | 4777   -  23.94%
>  2500.0000ms | 4241   -  21.25%
>  3000.0000ms | 968    -   4.85%
>  3500.0000ms | 0      -   0.00%
>  4000.0000ms | 0      -   0.00%
>  4500.0000ms | 7      -   0.04%
>  4143.9490ms | max
> ok
>
> ---
> Mac hacker with a performance bent
> http://www.linkedin.com/in/joelreymont
>
>



More information about the erlang-questions mailing list