4 ms·
I don't think this discussion is going anywhere, but for reference, my webserver does around 45 million requests a day, and yes, that's in a single thread. Webs
by axod 18y ago
I don't think this discussion is going anywhere, but for reference, my webserver does around 45 million requests a day, and yes, that's in a single thread. Webservers aren't typically cpu bound.
- ars 18y agoThanks for the numbers, 45 million and 5k are kinda different. I'm not trying to be argumentative, I have never done a very large scale website, and only now did I check your profile to see that you did. But I still don't understand how come it's better to do a single thread. Also, all my websites have been CPU bound. And even if it's IO bound, if you have more than one disk, adding a thread can only help, no?
- axod 18y agoAdding threads only helps if you have more cores, or if you're forced to use something that may block. But even then, it's better to have a set number of threads doing different tasks, rather than one per user. eg have a network thread, a db thread(s) etc.
- zmimon 18y agoFirst: this is a really interesting thread and I have a lot of respect for your experience. But is it really better to statically allocate resources to threads? You may have 8 cores on a box and 1 of them burning and 7 of them cruising. By utilizing a small thread pool and letting the scheduler spin things off dynamically you can turn that into 8 cruising instead. Just curious.
- axod 18y agoThe networking thread shouldn't be using hardly any CPU. If it is, then somethings badly wrong. It's better to have a single networking thread, trawling through the connections, moving data around, and have it talking to other threads that handle long jobs, cpu intensive tasks, or anything that might block.