This is following my earlier question Node.js Non Blocking Nature .
I still can’t feel I completely understand what is happening with Node.js . Lets say Node got a request for a big file upload from a user . Now we say we put the code to handle with the file in a callback , thus making it asynchronous . What happens next ? Lets say the callback got put in a big list of events the Node.js app needs to take care of , so thus far it is NOT blocking . But at some point the callback gets pulled out from the event loop and it’s code starts running (uploading or downloading the file , whatever) . What now ? Is the Node.js app being blocked now ? If so – how does it not destroy the app’s performance , and if not – who is in charge of ‘jumping’ between different events and requests ? We understand that in apache or similar servers there is special code to handle all the threads(timing them) so that no thread chokes all the others .In Node however , as I understand , there is an event loop . When the file I\O finishes , it’s callback magically returns with the ready file . Nevertheless , the server still has to do the I\O , no escaping that ! Is the code in the event loop being timed ? For example jumping between different events(callbacks..whatever) so that no request chokes the other? If so , in what manner ?
This is following my earlier question Node.js Non Blocking Nature . I still can’t
Share
I think this subject is complicated enough (at least for newcomers) to deserve a thorough read and can’t be understood by read a 5 line answer. This is the best resource I found http://www.theserverside.com/discussions/thread.tss?thread_id=61693 . He doesn’t think so highly of Node.js but he does take a lot of effort to explain it . Worth a read in my opinion.