> Can anyone shed any light on whether the nonblocking cpp server can do what > i want? I'm sorry, but no it won't. The TNonblockingServer uses a threadpool internally, so it still requires one thread per active outstanding request.
--David Andrei Makhanov wrote: > Hello, > > I've set up a C++ Server that has several types of jobs that it performs. > Some of these are very quick lookups that require virtually no processing > time. Others can take up to several hours of intense cpu processing to > complete. I am trying to make the service 'nonblocking' in the sense that > those small processes can always return quickly. At the same time, i want to > have the ability to run several (predefined number) of these large jobs > concurrently with new big jobs simply going into a waiting queue. The way my > system is set up currently, for some calls you dont know how long it will > take. If the job has been done before, it just returns the precomputed > results (quickly), but if it had not been done, it does the heavy duty > processing at that time (can take hours). > > From experimenting with TThreadedServer, it seems it just keeps spinning off > new threads to handle each request. If there are too many of these long > jobs, it can potentially bring down the whole server if a bunch of them get > requested around the same time. This server is always responsive, but very > prone to abuse. > > The threadpool server makes sure i never kill my machine, however, once it > has the predefined number of threads running, it stops responding to new > requests, or rather just sits on them until one of the big jobs completes. > > I've been looking at the Nonblocking server, but with the lack of > documentation, can't figure out if it will do what i want -- always respond, > while not killing my machine. > > Can anyone shed any light on whether the nonblocking cpp server can do what > i want? If so, how do use it? If not, can anyone recommend a different > solution? > > Thanks, > andrei
