You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@thrift.apache.org by Jonathan Marcus <ja...@jobstick.com> on 2009/04/25 01:11:39 UTC
PHP to C# latency & connection errors
Hi,
I'm making Thrift requests from my front-end web servers (running in
PHP) to my back-end app servers (running in C#). There are two problems,
and I think they're related, but I can't figure out what's causing them:
1. I'm having strange delays in the PHP client. If I make several
requests during a single page load, the first one will return quickly
(elapsed time < 1ms), but subsequent requests take up to 100 ms to
complete. This only happens from PHP - tests from other languages do not
have this delay, so I'm pretty sure it's not network latency.
2. After every request, errors are being thrown by the server, with the
message: "Thrift.Transport.TTransportException: Cannot read, Remote side
has closed". The TServer catches it and logs it, but I'm guessing that
it's related to the delays, i.e., that the PHP TClient isn't closing the
connection properly, and the C# TServer is timing out while waiting for
it to finish cleanly.
What's really strange is that all my requests complete successfully, and
my client and server are stable, only there's this mysterious delay with
(almost) every request, and these mysterious server-side errors.
Anybody have any ideas? I can't find anything in the documentation or in
forums, and I'm stumped.
Thanks,
Jonathan
-------------------------------------------
-- Client-Server setup:
-------------------------------------------
PHP: Using a TBinaryProtocol, wrapped around a TBufferedTransport,
wrapped around a TSocket.
C#: Using a TThreadPoolServer, wrapped around a TServerSocket.
-------------------------------------------
-- Call Stack for Server-Side Exceptions
-------------------------------------------
Thrift.Transport.TTransportException: Cannot read, Remote side has closed
at Thrift.Transport.TTransport.ReadAll(Byte[] buf, Int32 off, Int32
len) in \Thrift\Transport\TTransport.cs:line 44
at Thrift.Protocol.TBinaryProtocol.ReadAll(Byte[] buf, Int32 off,
Int32 len) in \Thrift\Protocol\TBinaryProtocol.cs:line 381
at Thrift.Protocol.TBinaryProtocol.ReadI32() in
\Thrift\Protocol\TBinaryProtocol.cs:line 327
at Thrift.Protocol.TBinaryProtocol.ReadMessageBegin() in
\Thrift\Protocol\TBinaryProtocol.cs:line 210