concept Java in category apache thrift

appears as: Java, Java, Java
Programmer's Guide to Apache Thrift

This is an excerpt from Manning's book Programmer's Guide to Apache Thrift.

To get a sense for the relative performance of several of the communications approaches described here, look at the test results in figure 1.4 (these tests are created and covered in detail in chapter 17). The chart displays the time required to make one million API calls to a single service implemented with several communications technologies. All of the servers were coded in Java and the same client, also coded in Java, was used in all cases, though the necessary bindings are used to call the service backend under test. Each bar shows the number of seconds the requests took to complete against a different implementation running on the same machine. The tests were performed in isolation over the local loopback on a system with no other activity. Multiple runs of each test were completed and no outliers were discovered. The sole service function accepts a string and returns a small struct. The service implementation is identical in all cases, performs no logic, and returns a static struct to highlight the service and serialization overhead.

Java as a language is a pillar of the open source world. Perhaps even more important than Java is the platform the Java language is based upon, the Java Virtual Machine (JVM). The JVM is the enabler of the marquee “write once run everywhere” feature promoted by the original Java developers. The JVM also provides a base for innovative new languages such as Scala, Groovy, and Clojure to build upon. Even languages popular as standalone interpreters, such as Python, Node.js, and Ruby, have been ported to the JVM to leverage its inherent interoperability and portability.

Table 12.4. Java layered transports (view table figure)

Layer

Factory

Base class

TFramedTransport TFramedTransport.Factory TTransport
TFastFramedTransport TFastFramedTransport.Factory TTransport
THttpClient THttpClient.Factory TTransport
TZlibTransport TZlibTransport.Factory TTransport

The TFramedTransport “frames” each message by adding a frame size (also known as message size) to the front of every message. Framing is only required when interacting with a non-blocking type server; in Java this includes the TNonblockingServer, THsHaServer, and TThreadedSelectorServer. Framing makes it possible for non-blocking server I/O threads to dispatch entire messages to worker threads without de-serializing the message to find out where it ends.