[erlang-questions] How to handle a massive amount of UDP packets?
Magnus Klaar
magnus.klaar@REDACTED
Sun Apr 15 23:52:25 CEST 2012
Hi!
You didn't really answer my question, but you may also want to look into
buffering the packets and spawning a process to handle the bufffer. It's a
lot more simple than maintaining a pool of worker processes. You only want
to do that if you're pooling resources that are expensive to create,
something which processes aren't.
MVH Magnus
On Sun, Apr 15, 2012 at 11:41 PM, John-Paul Bader <hukl@REDACTED>wrote:
> Ok, little update.
>
> I've changed the implementation to use {active,false} and a manual
> gen_udp:recv loop but that made things only slightly faster. Then I
> commented out the part where I spawned the processes which compute and send
> back the response to the clients and this gave a _huge_ speed improvement.
>
> I ran a benchmark on a fast server and could easily handle 100-200k
> packets per second without losing a single packet.
>
> So clearly my problem is dispatching the packet/message to the worker
> processes. I will experiment with a worker pool next instead of spawning
> the processes on demand.
>
> If you know how to do this dispatching with as little overhead as possible
> please let me know.
>
> ~ John
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20120415/ae4ac3b0/attachment.htm>
More information about the erlang-questions
mailing list