Node.js singlethreading concept -
if have long running process in node, how run process while still remaining responsive new user requests?
in other languages, such java, start daemon (background) thread , run process on that. node, if it's singlethreaded, how work?
there's concept of event-loop. when node process i/o operation (ie. reading db etc.), puts current request event-loop, , thread moves onto next request. when i/o done, thread picks callback
event-loop, , responds user.
because of paradigm, node.js able handle many requests in 1 thread, opposed of creating thread per requests.
Comments
Post a Comment