Velvet Star Monitor

Standout celebrity highlights with iconic style.

general

How to select Transport of thrift?TBufferedTransport or TFramedTransport?

Writer Olivia Zamora

What is the difference between TBufferedTransport and TFramedTransport? How to make choice?

1 Answer

TBufferedTransport implements simply an internal buffer that is put in between the sender/receiver part and the "raw" transports. The idea is to improve performance, but you should test if it really does in your particular use case.

In contrast, TFramedTransport adds a 4 byte header in front of the data carrying the number of message bytes to follow. This allows for certain optimizations on the receiving end. Furthermore, some server types implicitly require the client to use TFramedTransport.

Long story short

  • TFramedTransport is usually a good choice, but both ends have to support it, because it changes the message data that go over the wire.
  • Buffered transports can be used if "framed" is not an option. Since it does not change any data it can be used freely at will.
  • Using both is discouraged, because TFramedTransport already buffers data internally.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.