Why use Multi-thread Servers?
-
Hi, all :) I am planning on an http web server, and I have read some of the I/O completion and multithread server articles, but I really don’t understand why anyone would develop a multithread server? Would it just make it more difficult and slow, because of all the critical sections that have to be thread-safe? Why use worker threads that loops until a service is requested. Can’t you just use completion callback and windows message-based notification of network events to serve connected users? What’s the point of using multiple threads in a server? My server is going to run on older windows versions (95/98/ME) so I have to handle the worker threads (if I should use them) and connection sockets by my self, and of course the server has to support at least 500 user connections simultaneously. Anyway, I really don’t see any performance advantage by using multiple threads, so please tell me what I am missing because it seems like everyone is using it. :( Thanks in advance Aidman » over and out
-
Hi, all :) I am planning on an http web server, and I have read some of the I/O completion and multithread server articles, but I really don’t understand why anyone would develop a multithread server? Would it just make it more difficult and slow, because of all the critical sections that have to be thread-safe? Why use worker threads that loops until a service is requested. Can’t you just use completion callback and windows message-based notification of network events to serve connected users? What’s the point of using multiple threads in a server? My server is going to run on older windows versions (95/98/ME) so I have to handle the worker threads (if I should use them) and connection sockets by my self, and of course the server has to support at least 500 user connections simultaneously. Anyway, I really don’t see any performance advantage by using multiple threads, so please tell me what I am missing because it seems like everyone is using it. :( Thanks in advance Aidman » over and out
Aidman wrote: windows message-based notification of network events to serve connected users? What’s the point of using multiple threads in a server? This is slooooow, and needs a Window which most servers dont have ;) Aidman wrote: My server is going to run on older windows versions (95/98/ME) so I have to handle the worker threads (if I should use them) and connection sockets by my self, and of course the server has to support at least 500 user connections simultaneously. 500 users at the same time on Win9x, interesting ;) Aidman wrote: Anyway, I really don’t see any performance advantage by using multiple threads, so please tell me what I am missing because it seems like everyone is using it. Normally I use asynchronous socket, or if on NT based systems, IO Completion Ports. A limited number of threads is a good thing, it makes the application scale on multi-CPU computers, a single threaded server only uses a single CPU. And also, when a thread is "suspended" when waiting for IO like disk or network activity, it's good to have extra threads to keep the processor(s) working (if there is work to do, of course) - Anders Money talks, but all mine ever says is "Goodbye!"
-
Hi, all :) I am planning on an http web server, and I have read some of the I/O completion and multithread server articles, but I really don’t understand why anyone would develop a multithread server? Would it just make it more difficult and slow, because of all the critical sections that have to be thread-safe? Why use worker threads that loops until a service is requested. Can’t you just use completion callback and windows message-based notification of network events to serve connected users? What’s the point of using multiple threads in a server? My server is going to run on older windows versions (95/98/ME) so I have to handle the worker threads (if I should use them) and connection sockets by my self, and of course the server has to support at least 500 user connections simultaneously. Anyway, I really don’t see any performance advantage by using multiple threads, so please tell me what I am missing because it seems like everyone is using it. :( Thanks in advance Aidman » over and out
Multiple threads buy you nothing as long as you don't have an extra CPU available. Oh and if you are never waiting on resources. Well, such as reading a file. Then multiple threads buy you everything. Tim Smith I'm going to patent thought. I have yet to see any prior art.
-
Hi, all :) I am planning on an http web server, and I have read some of the I/O completion and multithread server articles, but I really don’t understand why anyone would develop a multithread server? Would it just make it more difficult and slow, because of all the critical sections that have to be thread-safe? Why use worker threads that loops until a service is requested. Can’t you just use completion callback and windows message-based notification of network events to serve connected users? What’s the point of using multiple threads in a server? My server is going to run on older windows versions (95/98/ME) so I have to handle the worker threads (if I should use them) and connection sockets by my self, and of course the server has to support at least 500 user connections simultaneously. Anyway, I really don’t see any performance advantage by using multiple threads, so please tell me what I am missing because it seems like everyone is using it. :( Thanks in advance Aidman » over and out
Thanks for your replys, but I am still a bit confused :confused: Are windows message-based notification of network events really slow? Can't they serve connected users, like reading from disk or sending data? If I should have say up to 100 users connected to my server simultaneously, how is the best way to serve them? worker threads, windows message-based notification or somthing else? And also, is it better to let threads loop until data is recieved or to use windows message-based notification? Aidman » over and out We haven't inherited Earth from our parents, instead we have borrowed her from our children; an old Indian saying.
-
Thanks for your replys, but I am still a bit confused :confused: Are windows message-based notification of network events really slow? Can't they serve connected users, like reading from disk or sending data? If I should have say up to 100 users connected to my server simultaneously, how is the best way to serve them? worker threads, windows message-based notification or somthing else? And also, is it better to let threads loop until data is recieved or to use windows message-based notification? Aidman » over and out We haven't inherited Earth from our parents, instead we have borrowed her from our children; an old Indian saying.