[erlang-questions] How to handle a massive amount of UDP packets?
John-Paul Bader
hukl@REDACTED
Mon Apr 16 07:23:46 CEST 2012
Sorry,
so far I did not set the mentioned properties to higher values and will
experiement with that as well.
Magnus Klaar wrote:
> 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
> <mailto: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
>
>
More information about the erlang-questions
mailing list