Subj : Re: Can long blocking tasks scale? To : comp.programming.threads,comp.parallel From : Markus Elfring Date : Tue Sep 06 2005 11:22 pm [c.p. moderator back.] Hans Malherbe wrote: > What if your Windows server has to call a service that takes "long" and > you need to make every effort to make it scale to as many concurrent > requests as possible? Are you sure that this kind of session management was not packaged into a software library before? > The problem is that the called service is a "black box" (mainframe > program) which cannot be divided into smaller bits. Do you know how satellite communication to the moon, mars or any other planets and stars is organized with its noticeable transmission times? > Currently every request consumes a thread which is mostly busy doing > nothing but wait. Did you try alternative techniques for the multiplexing of the processing? Which approaches from other client/server APIs can be reused? > Assuming the called service takes 40 seconds to respond with a request > rate of 20 per second, we'll need to create 800 threads before the > first ones start to return. > > It seems silly to hit the wall at 50 requests per second (2000 threads > with 1 MB stack reserved per thread on Windows 2000 Server) when > essentially they are all just waiting instead of doing. How much can you decrease the stack size for your application? > One proposed solution was to have the client make the request and drop > the connection after which the client will poll to retrieve the result. > The server thread will request from the "black box" and exit. The > problem with this is that the "black box" must change significantly. Are there any chances for an asynchronous (non-blocking) and bidirectional communication protocol on the application layer? > Complexity aside, how does this solution stack up against the > alternative of one thread per request? Are thread pools an useable option to manage any waiting queues in your case? > Am I even asking the right questions? Would you like to consider a cooperation with a message or notification service like the tool "http://www.xmlblaster.org/"? Regards, Markus -- .