[erlang-questions] Re: 20k messages in 4s but want to go faster!
Joel Reymont
joelr1@REDACTED
Mon Jul 13 10:59:18 CEST 2009
On Jul 13, 2009, at 8:58 AM, Jim Morris wrote:
> I think it is actually faster.
Have you measured it?
> My server uses a gen_fsm for each
> socket/client connection. When I get a message that needs
> broadcasting/
> unicasting to all the other clients, I get a list of all the PIDS of
> the gen_fsm's, and send an erlang message to each of the pids,
That's what I (used to) do as well.
> when the 8,000 or so gen_fsm processes get that message they do a
> tcp send
> to their client. That is getting the fastest throughput for me.
How do you know it's getting the fastest throughput for you?
I won't believe doing an extra round trip through a gen_* server
is faster than pushing a static chunk of binary data to a list of
sockets.
Please prove me wrong!
> Also if you do a tcp send from different processes to the same socket
> you will get contention, and no guaranteed order, just an FYI.
No such use case.
> The whole reason for me using Erlang was that I could do one process
> per socket, as processes were so cheap.
I agree with you on processes being cheap and I use processes liberally.
I'm trying to optimize a specific use case, though, which is pushing
a chunk of binary data to 20k clients.
Also, I spent a LOT of time optimizing OpenPoker last fall. I used to
have
an architecture where everything was a process. I had a gen_server for
the
common game functionality, a gen_fsm for game logic, gen_servers for
handling
pots, seats, etc.
Drastically cutting down on the number of processes significantly
improved throughput.
---
Mac hacker with a performance bent
http://www.linkedin.com/in/joelreymont
More information about the erlang-questions
mailing list