thrift-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Lars Benner <LBen...@tomtec.de>
Subject RE: Documentation, differences multithreaded server and non-blocking server
Date Sat, 26 Oct 2013 09:53:45 GMT
Hello Randy, hello Benjamin,

thank you very much for your explanations and I learned what I was looking for. 

I knew now, that I will go for the TThreadPoolServer. My server has to handle only a very
limited number of concurrent connections, but a lot of them in a row, so I assume the thread
pool version to be faster. 

Thanks again,
- Lars

________________________________________
From: Benjamin Beier [benjamin@desaster-games.com]
Sent: Thursday, October 24, 2013 19:03
To: user@thrift.apache.org
Subject: Re: Documentation, differences multithreaded server and non-blocking server

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



Mime
View raw message