thrift-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Wang, Yongkun | Yongkun | BDD" <yongkun.w...@mail.rakuten.com>
Subject Performance drops seriously when using bi-directionaly RPC
Date Tue, 14 Feb 2012 07:21:32 GMT
Hi, guys

I am trying to the following case with thrift in java:

Client sends data to server, then server sends back a message by the same connection (TTransport).
Server should be able to send back the message at any time, so I cannot use “piggy back”
when client sends data.

I wrote a java application with bi-directional RPC, with the reference of Joel Meyer's excellent
example (https://github.com/JoelPM/BidiThrift).

On server side:
One thread starts the thrift server (TSimpleServer), another thread will capture the connection
from client, and send data to client;

On client side:
One thread will do RPC to server to send data, and another thread will simulate a thrift server,
waiting for the data from server side.

But I find that the performance drops seriously (more than 50%) even when the server does
not send any data.

I am checking the reason. I feel that maybe there are some blocking until timeout. Maybe on
client side, the thread with following code to simulate a thrift server and receive the data
from server side, may be blocked when no data is coming:

while ( true ) {
    while ( processor.process( protocol, protocol ) == true ) {}
}

Maybe the non-blocking server (TNonblockingServer) does not have the performance issue. But
I cannot use the non-blocking server.

I attached a sample code in this email.

Any suggestions would be appreciated.
Thank you very much.

Regards,
Kun
Mime
View raw message