On 10/24/2013 10:36 AM, Lars Benner wrote:
I have at the moment a simple, single threaded server running in C++ and I 
figured out, I can have only a single client connection at a time. Ok this did 
not really surprise me.

Since I need to multiple client/server connections at the same time, I assume I 
have use either a multithreaded or a non-blocking server. Therefore, I would 
like to know, what the differences between a multithreaded server and a 
non-blocking server are. I have a general understanding of these concepts. But 
I do not know, how they are implemented in thrift and what for implications 
these different concepts have for my server functionality implementation and 
the client usage.

So exist some documentation, which I couldn't find, describing this? Or can 
somebody give me an overview from 10,000 ft?

Thanks a lot,
- Lars

I am new to thrift myself, but from what i understand, it works as follows:

TThreadedServer:
Each client connection is handled by one thread, until all threads are in use.
    With 8 threads you can handle 8 concurrent client connections.
Every time a client connects to the server a new thread is created and destroyed again at disconnection.

TThreadPoolServer:
Each client connection is handled by one thread, until all threads of the pool are in use. With a pool size of 8 threads you can handle 8 concurrent client connections.
    Threads are only create once and reused afterwards.

TNonblockingServer:
    The number of possible client connections isn't limited anymore.
    All threads of the pool are processing client request simultaneously.
On the client side requests sill seem to be blocking, but on the server side they are handled non-blocking.

TNonblockingServer + AsyncClient:
Same behavior on the server side, but client request return immediately and a given callback method is executed as soon as it is processed.

Correct me if i am wrong... just wanted to help... :)

Regards,
Benjamin

Reply via email to