Benchmarks demonstrated that the idle timer handle approach didn't balance the load quite fair enough, the majority of new connections still ended up in one or two processes. The new approach voluntarily gives up a scheduler timeslice by calling nanosleep() with a one nanosecond timeout. Why not sched_yield()? Because on Linux (and this is probably true for other Unices as well), sched_yield() only yields if there are other processes running on the same CPU. nanosleep() on the other hand always forces the process to sleep, which gives other processes a chance to accept our pending connections. |
||
|---|---|---|
| .. | ||
| uv-private | ||
| uv.h | ||