Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine

Re: Re: Efficient non-blocking UDP server

by liz (Monsignor)
on Mar 20, 2004 at 21:25 UTC ( #338368=note: print w/replies, xml ) Need Help??

in reply to Re: Efficient non-blocking UDP server
in thread Efficient non-blocking UDP server

I would be surprised if Thread::Queue would have the performance needed for handling hundreds of UDP packets.

If you realise that a shared array (to which Thread::Queue is a very simple frontend) stores its valus both in the current thread as well as in the hidden background thread. Not very performance friendly.

If you want to try Thread::Queue for this application, make sure that you have Perl 5.8.1 or higher, as 5.8.0 has a severe memory leak with shared arrays.


  • Comment on Re: Re: Efficient non-blocking UDP server

Replies are listed 'Best First'.
Re: Re: Re: Efficient non-blocking UDP server
by calin (Deacon) on Mar 21, 2004 at 19:19 UTC

    liz, thanks for feedback. I didn't realize Tread::Queue could be so costly ; my suggestion was the result of a mere query on CPAN by the word queue ; the module looked interesting.

    There's another thing: I suppose the OP requires hundreds of packets per second as a burst condition, right? The perspective of coping with a sustained condition like that, I mean receiving and processing that amount in pure Perl, in real time, looks dim. Even if the receiving routine is fast enough, the queue would quickly fill up. (there's a discussion on what the "processing" amounts to). Anyway, that calls for optimized C code, IMHO.

    All in all, I think the main idea of my original reply (treat your network code as an interrupt handling routine) is still valid in the context of datagram protocols.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://338368]
marioroy I once fell asleep while drive and had no collection on how I exited the ramp. Then called my wife not knowing where I was totally lost.
marioroy At a large firm, had to awaken a security guy a few times so that nobody would catch him sleeping.
marioroy On a large dairy farm, almost went off the road with a 10 wheeler from exhaustion. On the farm, almost went off the silo with a big tractor. At the Fransiscan monastery, almost slipped off the dome while painting it.

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (7)
As of 2017-05-29 08:20 GMT
Find Nodes?
    Voting Booth?