4 ms·
> NodeJS [...] with its thread-per-request model Node.js doesn't create a thread per request; it's single-threaded with evented I/O. You can use node-cluster t
by tannhaeuser 5y ago
> NodeJS [...] with its thread-per-request model
Node.js doesn't create a thread per request; it's single-threaded with evented I/O. You can use node-cluster to start more than a single thread to saturate multi-core CPUs and load-balance HTTP requests across these, but that doesn't make it thread-per-request.
- an_account_name 5y agoSuspect they're talking about Java - a lot of frameworks do exactly create a thread per request.
- didibus 5y agoI can't think of any framework that still does one thread per request. Normally there is a a queue of incoming requests and they then get dispatched on a thread pool as threads return to the pool. The challenge is normally that if any of the threads in the pool, as part of processing a request, needs to itself make an IO call, it will block. Ideally you'd want to park the request processing, return the thread to the pool, pick up the next request, until the IO is done where then on the next thread available from the pool you'd resume that request instead of picking another one. This is what the virtual threads will make really easy I think.
- MikeTheGreat 5y agoI think my high school English teacher would agree with you that the sentence is written awkwardly (I can see the 'awk' note, in red, on my paper right now :) ). Here's how I parsed it: > a big reason that NodeJS won a lot of popularity on the server is that, for many types of common webserver workloads [...], NodeJS can actually scale much better than Java with ~~it's~~ [Java's] thread-per-request model.
- tannhaeuser 5y agoAh that makes sense; didn't get this reading at all!
- bradfitz 5y ago> ~~it's~~ Why are you calling that out? The original "its" was correct without the apostrophe.
- MikeTheGreat 5y agoTwisol was right - I was trying to imply strikethrough using the Markdown syntax in an attempt to depict the idea of replacing "its" with "Java's". It didn't work as well as I hoped. In my mind I can see more 'Awk' scribbles on my post, and looking at it I agree :) Adding in the 's is 100% my mistake. I've been guilty of using "it's" as the possessive form for most of my life, but that changes today! :)
- bradfitz 5y ago> but that changes today! :) Exciting! :)
- Twisol 5y agoTildes are used for strikethrough in some markup dialects (including markdown), so I think they meant to depict replacing "its" with "Java's". No clue on the apostrophe.
- nayuki 5y ago(Forgive my grammar nazism.) The possessive form of "it" is "its": "The dog wagged its tail". But for basically everything other than pronouns and plurals, the possessive form involves adding "apostrophe s". In recent years, many people have tried to apply this rule to "it". But the problem is that "it's" is understood to be a contraction of "it is" or "it has"; furthermore, "its" already exists as the standard possessive form. One thing I say to people using "it's" is that by analogy, you also need to say: "He got he's skills. She missed she's ride. They have they's meeting."
- MikeTheGreat 5y agoThank you a ton for posting this! I've been doing this for most/all of my life and it didn't really make sense till now. I've had people explain it before but it didn't really make sense. Here's what I got from what you wrote (please correct me if this is wrong / kinda off in some way) For most words, the possessive form is "<word>'s" For pronouns (including it) there are different rules. He becomes his, she goes to hers, it goes to its. Also, words that already end in s don't get the " 's " treatment. (Question - for words that end in "s", we put the apostrophe after the existing, ending 's', yes?) Thanks again for posting this - viewing the possessive form of it as (yet another English language) exception to the normal rule of " 's " is really helpful.
- hn_throwaway_99 5y agoSorry, yes, my sentence was poorly written with the ambiguous antecedent. Most Java webservers use a thread-per-request model, which is why Node can usually scale to more concurrent requests.