Hacker Timesnew | past | comments | ask | show | jobs | submitlogin

Depending on your platform, how many children you've forked, and your rate of incoming connections, this design could expose you to a thundering herd.

You might find that you get better performance by having the parent call accept() and hand off sockets to the children. With sufficient abuse of LD_PRELOAD you can probably do this without making any changes to the child processes -- you just need to override accept() with a function which checks if any sockets have been handed off.



That's a fair point. Even if your accept() implementation is fine, event-driven workers would instead be select()ing on the shared socket, which can also lead to a thundering herd. I think you'd need quite a few worker threads before this became an issue in practice though.


Indeed, it's an edge case... but it's a painful one if people do run into it.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: