thrift-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chandramouli Rangarajan <mahesh...@gmail.com>
Subject Using Java TAsyncClient with Zlib compression
Date Wed, 19 Aug 2020 18:19:11 GMT
We have a Java client-server application which uses Thrift RPC. Until now,
we've been using the (generated) synchronous Client code to send requests
to the server. The server uses TThreadedSelectorServer (non-blocking) with
TZlibTransport. On the client side, we use a connection pool in order to
re-use the underlying transport whenever possible, where each transport is
of type TZlibTransport.

This has been working fine for us, but we've decided to use the
TAsyncClient interface to reduce the number of application threads on the
client side. However, I can't seem to find a way to use TZlibTransport with
re-usable TCP connections (TNonblockingSocket).

One way I tried to make this work is by defining a custom protocolFactory,
which generates a TZlibTransport(and wraps the underlying buffer which is
used by TAsyncMethodCall) for every request/response. Turns out that this
doesn't work since it creates a new Deflater/Inflater stream for every
request. Every request after the first request on a particular connection
will cause a gzip Exception on the server while reading the request.

I've been breaking my head over how to make this work, unless I've missed
something very obvious. Would appreciate any help regarding this.

-- 
--Chandramouli

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message