sharing udp socket between several processes

Kirill Timofeev kirill.timofeev at hulu.com
Wed Dec 30 19:50:24 CET 2015


Hi Marc,

thanks for quick response. I couldn't find any signs of errors on the 
sending side, but was able to resolve this by opening separate socket in 
each process with option SO_REUSEPORT (details here: 
https://lwn.net/Articles/542629/). I also switched to pthreads to 
minimize context switching overhead and removed logging, which was 
becoming bottleneck with heavy incoming traffic. Please find working 
prototype attached and thanks for libev!

Happy New Year!

Thanks,
Kirill.

On 12/29/2015 09:27 PM, Marc Lehmann wrote:
> On Tue, Dec 29, 2015 at 12:20:43PM -0800, Kirill Timofeev <kirill.timofeev at hulu.com> wrote:
>> but I see that some incoming packets are lost with 2 childs:
> All I can see is that 8476 packets apparently have been received, not hat
> they have been lost - you don't seem to do any error checking on send, and
> depending on how fast ruby does it's thing, it could easily make the kernel
> run out of packet buffers.
>
> so first make sure you don't get ENOBUFS or another error.
>
> I haven't looked at your progrma in detail, but since running two
> processes is much less efficient than one, I would first check that you
> really did send all those packets.
>
> I also don't know of anything that could go wrong specifically with
> multiple processes, apart from the myriad issues around udp receiving in
> general.
>

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 025-udp-test.c
Type: text/x-csrc
Size: 4494 bytes
Desc: not available
URL: <http://lists.schmorp.de/pipermail/libev/attachments/20151230/bbb760a3/attachment.c>


More information about the libev mailing list