You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@thrift.apache.org by buddhika chamith <ch...@gmail.com> on 2012/07/23 09:00:42 UTC

Does TThreadPoolServer multiplex connections?

Hi All,

I am working on a project which uses a TThreadPoolServer with TServerSocket
transport to expose it's Thrift service. The service has been written in a
way such that it assumes once a client connection is made it will be served
by the same thread in the thread pool. (e.g: It's using thread locals
heavily to maintain session information associated with a client
connection). But I am seeing some weird issues when multiple connections
are made concurrently which makes me think this is not so. So what I need
to know is that whether TThreadPoolServer multiplex connections among
different threads and whether it is the correct behavior if it is so. I
thought this was only true for TNonblockingServer.Any response is highly
appreciated.

Regards
Buddhika

Re: Does TThreadPoolServer multiplex connections?

Posted by buddhika chamith <ch...@gmail.com>.
Hi David,

In fact I am using Thrift Java binding with thrift version 0.7. Hopefully
you might know the comparable in the Java implementation?

Regards
Buddhika

On Mon, Jul 23, 2012 at 5:31 PM, David Nadlinger <co...@klickverbot.at>wrote:

> Hi Buddhika,
>
> On Mon, Jul 23, 2012 at 9:00 AM, buddhika chamith
> <ch...@gmail.com> wrote:
> > So what I need
> > to know is that whether TThreadPoolServer multiplex connections among
> > different threads and whether it is the correct behavior if it is so. I
> > thought this was only true for TNonblockingServer.Any response is highly
> > appreciated.
>
> I'm not a C++ library dev, but I'm reasonably certain that once a task
> (here: connection) has been grabbed by a worker thread in the thread
> pool, it will run to completion there. If you want to check this, you
> could just log the output of pthread_self() together with some
> connection ID at, no?
>
> David
>

Re: Does TThreadPoolServer multiplex connections?

Posted by David Nadlinger <co...@klickverbot.at>.
Hi Buddhika,

On Mon, Jul 23, 2012 at 9:00 AM, buddhika chamith
<ch...@gmail.com> wrote:
> So what I need
> to know is that whether TThreadPoolServer multiplex connections among
> different threads and whether it is the correct behavior if it is so. I
> thought this was only true for TNonblockingServer.Any response is highly
> appreciated.

I'm not a C++ library dev, but I'm reasonably certain that once a task
(here: connection) has been grabbed by a worker thread in the thread
pool, it will run to completion there. If you want to check this, you
could just log the output of pthread_self() together with some
connection ID at, no?

David