If the C++ NonblockingServer is like the Java one, which I think it is, then it uses nonblocking IO to communicate with clients in a single thread, and then performs the method invocations either in that same thread or in a limited threadpool. The purpose is to avoid having to have a thread per connection.
ThreadPoolServer uses a thread per client connection (up to a certain limit) and performs the IO and invocation in that thread. You run the risk of having slow connections take up a thread for a long time and blocking other invocations from occurring. At least in the Java ThreadPoolServer, you also have the issue that it's not a "fair" server - that is, once a socket is assigned to a thread from the pool, that thread will remain busy until the socket is *closed*, meaning that you need to have as many threads as you want to have concurrent connections, not just concurrent method executions. -Bryan On Thu, Jul 22, 2010 at 7:15 AM, 萧超杰 <[email protected]> wrote: > so what is the differences between TNonBlockingServer and > TThreadPoolServer? > > 2010/7/22 Łukasz Michalik <[email protected]> > > > On 16:34 2010-07-22 +0800, 萧超杰 wrote: > > > if i use TThreadPoolServer is this server a nonblocking server? > > > > > > > It is nonblocking in the sense, that it doesn't block, but keep in > > mind that it spawns a thread (or uses one from pool) each time a > > client connects. > > > > -- > > A: Because it messes up the order in which people normally read text. > > Q: Why is top-posting such a bad thing? > > A: Top-posting. > > Q: What is the most annoying thing on usenet and in e-mail? > > > > Pozdrawiam, > > Łukasz P. Michalik > > >
