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

They both contain some truth and some falsehood.

Essentially the first one is most right. Non-blocking IO can get a lot of work done as it is never hindered by doing nothing while waiting around for slow IO. It never blocks so it can always do work.

However, if a non-blocking system has too much work to do it can still max out a CPU. At this point you, ideally, need as many worker threads as you have CPUs.

However, a threaded system that doesn't use non-blocking IO runs the risk of having many blocked threads eating up a CPU & memory instead. This is largely dependent on the light-weight-ed-ess of the threads.

Both these systems are effected by how much work the server has to do to create a response, thus even non-blocking IO can become swamped if it uses a slow language, too much memory or the wrong algorithm, plus all IO must not block or else the non-blocking networking ends up waiting around for blocking files.

There are other complications too like the number of file handles a process can issue that can also impede a server and the number of clients it can simultaneously serve.



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

Search: