Hello, I'm new to Node. It looks very wonderful so far, I must say.
Is there any official documentation on Node Internals, addressing questions such as the following: 1. How is the priority of the main thread that initiates the asynchronous I/O, creates servers etc handled vis-a-vis the event-handler thread that calls the callbacks? Do I have to know about this aspect of things as a Node programmer? 2. To use multi-cores, I can have multiple Node processes, sure. But how do I serialize/synchronize these processes when doing a set of (non-atomic) operations in an atomic manner over, say, a filesystem or a database? 3. How big is the Node's worker thread-pool? Is its size configurable, or does it automatically scale up/down with load? When this thread pool is full, say, due to OS limitations or due to configuration parameters (provided that is even possible), does Node block or throw an exception or crash when yet another worker thread needs to be engaged? 4. Since I/O happens asynchronously in worker threads, it is possible for a single Node process to quickly/efficiently accept 1000s of incoming requests compared to something like Apache. But surely the outgoing responses for each of those requests will take their own time, won't it? For example, if an isolated request takes a minimum of 3 seconds to get serviced (with no other load on the system), then if concurrently hit with 5000 of such requests, won't Node take A LOT of time to service them all? If this 3-second I/O task happens to be involve exclusive access to certain resources, then it would take 5000 x 3 sec = 15000 sec, or over 4 hours of wait to see the response for the last request coming out of the app. In such scenarios, would it be correct to say that a single-process Node configuration can handle 1000s of requests per second, especially compared to Apache (akin to the nginx-Apache benchmark), when all that Node may be doing is putting the requests on hold till they get serviced? I'm asking this because as I'm reading up on Node I'm often hearing how Node can address the C10K problem without any co-mention of any special application setup. 5. What about the context switching overhead of the workers in the thread pool? If C10K requests hit a Node-based application, won't the workers in the thread pool end up context-switching just as much as Apache's regular thread pool...? because all that would have happened in Node's main thread would be a quick request-parsing and -routing, with the remainder (or, the bulk) of the processing still happening in some thread somewhere? That is, does it really matter (as far as minimization of thread context-switching is concerend) whether a request/response is handled from start to finish in a single thread (in the manner of Apache), or happens up in a Node-managed worker thread with only minimal work (the request parsing and routing) subtracted from it? Thanks and regards, /HS -- Job board: http://jobs.nodejs.org/ New group rules: https://gist.github.com/othiym23/9886289#file-moderation-policy-md Old group rules: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines --- You received this message because you are subscribed to the Google Groups "nodejs" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/nodejs/97e5edef-365b-4a45-8c43-c3ce13bae118%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
