You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@thrift.apache.org by Jaguar Xiong <xi...@gmail.com> on 2014/08/09 17:40:06 UTC

Need advice for parallel requests

Hi,
     We are considering using thrift for peer to peer communicaiton, the 
system contains multiple nodes, and each node could send multiple 
requests (without waiting for response from previous requests) to any 
other nodes.
     But looking into message definition, I could find message 
type(call,response,exception,etc), sequence number, which seems fit the 
purpose. But I don't know if any of the existing Server (TSimpleServer, 
TNonblockingServer, etc) really fit my need.
     Could you share some ideas on existing components, or any starting 
point for implement such feature?

Thanks!
Jaguar

Re: Need advice for parallel requests

Posted by Jens Geyer <je...@hotmail.com>.
Hi,

> each node could send multiple requests (without waiting
> for response from previous requests) to any other nodes.

If I get the problem right, you want to match incoming (async) responses 
against a list of known outstanding requests. A proven solution is to add a 
correlation ID to request and response, which can be basically anything (we 
mostly use UUIDs). The only important thing is that the server in the 
response always sends back the ID found the request.

BTW, your scenario calls for oneway calls. Have a look at them.

Have fun,
JensG


-----Ursprüngliche Nachricht----- 
From: Ben Craig
Sent: Saturday, August 9, 2014 7:22 PM
To: user@thrift.apache.org
Subject: Re: Need advice for parallel requests

The easiest solution would be to create multiple connections / client
objects... possibly even one client object per request.  You should see if
that will perform well enough for your requirements first.  If it doesn't,
then you will need to do some code generator work to make a thread safe
client object, and a server that can process multiple requests from the
same connection in parallel.  Thrift's current C++ servers will only
process one request at a time on a given connection, though multiple
connections are processed in parallel.

All of the current C++ servers respect the sequence id that is handed to
them, but the current C++ clients always set a sequence id of zero.  Until
you have a thread safe client object, you don't really need the sequence
id.

Jaguar Xiong <xi...@gmail.com> wrote on 08/09/2014 10:40:06 AM:

> From: Jaguar Xiong <xi...@gmail.com>
> To: user@thrift.apache.org,
> Date: 08/09/2014 10:40 AM
> Subject: Need advice for parallel requests
>
> Hi,
>      We are considering using thrift for peer to peer communicaiton, the

> system contains multiple nodes, and each node could send multiple
> requests (without waiting for response from previous requests) to any
> other nodes.
>      But looking into message definition, I could find message
> type(call,response,exception,etc), sequence number, which seems fit the
> purpose. But I don't know if any of the existing Server (TSimpleServer,
> TNonblockingServer, etc) really fit my need.
>      Could you share some ideas on existing components, or any starting
> point for implement such feature?
>
> Thanks!
> Jaguar 


Re: Need advice for parallel requests

Posted by Ben Craig <be...@apache.org>.
The easiest solution would be to create multiple connections / client 
objects... possibly even one client object per request.  You should see if 
that will perform well enough for your requirements first.  If it doesn't, 
then you will need to do some code generator work to make a thread safe 
client object, and a server that can process multiple requests from the 
same connection in parallel.  Thrift's current C++ servers will only 
process one request at a time on a given connection, though multiple 
connections are processed in parallel.

All of the current C++ servers respect the sequence id that is handed to 
them, but the current C++ clients always set a sequence id of zero.  Until 
you have a thread safe client object, you don't really need the sequence 
id.

Jaguar Xiong <xi...@gmail.com> wrote on 08/09/2014 10:40:06 AM:

> From: Jaguar Xiong <xi...@gmail.com>
> To: user@thrift.apache.org, 
> Date: 08/09/2014 10:40 AM
> Subject: Need advice for parallel requests
> 
> Hi,
>      We are considering using thrift for peer to peer communicaiton, the 

> system contains multiple nodes, and each node could send multiple 
> requests (without waiting for response from previous requests) to any 
> other nodes.
>      But looking into message definition, I could find message 
> type(call,response,exception,etc), sequence number, which seems fit the 
> purpose. But I don't know if any of the existing Server (TSimpleServer, 
> TNonblockingServer, etc) really fit my need.
>      Could you share some ideas on existing components, or any starting 
> point for implement such feature?
> 
> Thanks!
> Jaguar