I would like to know what a threaded web server is?

I have performed many searches but am unable to find anything that gives a clear explanation or definition; perhaps somebody can enlighten me.


A threaded web server is one that handles each request with a new thread, as opposed to handling each request with a new process.

Multi-threading is more complex than concurrency with processes, so there's an increased risk of the web server crashing if one of its modules isn't working correctly. Also, if it does crash, it's more likely to crash all of the threads (ie. all of the requests being handled at the time). However, multi-threaded servers consume less memory and are generally faster.

Here's a benchmark comparing the two (mutually exclusive) apache modules: prefork and worker.


and their definitions...



| improve this answer | |
  • As a note: "as opposed to handling each request with individual processes" - there would be other options, too to implement a server. Like event-based where single thread in a single process uses event-based socket-operations – johannes Apr 27 '11 at 10:22
  • Agreed... as in node.js ( stackoverflow.com/questions/5681853/… ) – Homer6 Apr 27 '11 at 10:26
  • I don't think the definition of multithreaded server is necessarily 1 request 1 thread. I don't think that would scale real well. – Justin Meiners Jul 16 '13 at 22:23
  • You're right. It doesn't. However, that model has been present for some time. I'm not sure that the definition is necessarily one thread per request either. Having a finite thread pool would also be considered a threaded web server. I believe the one thread per connection is more of a pedagogical model, as it's easier to build than a server that uses a thread pool instead. – Homer6 Jul 17 '13 at 4:58

It's a web server that has a queue for incoming HTTP requests and a pool of threads for satisfying them. The server takes the first request off the queue and assigns a thread from the pool to do the work. Requests line up in the queue when they come in faster than the threads can process them or if the pool runs out of threads.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.