Unicast 20k messages, $500-$1000 bounty

Jim Morris <>
Thu Jul 16 23:01:23 CEST 2009

Seeing as I have a similar server that can do 20,000 subscribers
easily under 1s (more like 600ms), I am trying to see where the major
differences are.

First with the change to a list of pids rather than an ets table makes
the broadcast loop almost the same as mine. I store all the
subscribers in a list, and add/delete them as needed (an uncommon

I also go through two gen_server procs before the tcp:send, so I don't
think that is a problem.

I do not use HIPE, I found it makes very little difference on my setup
(maybe 5% at best).

Doing a tcp send in the loop I think will make it much slower, for
reasons I explain in the previous thread.

I do not bump the priority around my broadcast list comprehension,
although I may try that to see if it speeds my server up even more.

Other than the JSON munging there is no other major difference
anymore. other than the way the stats are gathered, which may be the
source of discrepancy, I'll need to look more closely at how you do
that, I do like the histogram approach so I may incorporate that in
mine rather than min/max/ave which is what I do now.

Also the way the test clients are setup is very different to the way I
do it, although I doubt that is significant. I basically have a
latency tester running in its own VM, and it spawns the given number
of TCP clients as regular processes, and they do very little other
than connect, and wait for messages, extract the timestamp from the
message, and store the results. When the latency tester stops it sends
a message to each client process to end, and they send their results
to the tester. Although I'll never have 20,000 clients in a single
topic, I need to have sub 10ms latency on every message with 200
subscribers, which I currently achieve handily.

This has been an interesting exercise I look forward to seeing the end

More information about the erlang-questions mailing list