Simple Thrift tutorial

I briefly explain here how to build a simple Thrift application in Java that returns the time on the server.

First, define the Thrift interface in file time.thrift:

# time.thrift
namespace java tserver.gen
typedef i64 Timestamp
service TimeServer {
   Timestamp time()

Generate the Java code:

thrift --gen java time.thrift

Import the generated code into your workspace. Now, we will implement the interface in the file

Continue reading


Java NIO really faster than traditional IO ?

According to Jeremy Manson and Paul Tyma, NIO is not faster than the old traditional IO. Paul Tyma argues that since the Native Posix Thread Library (NPTL) arrived in Linux 2.6, multithreading is so cheap that it outperforms the select-based NIO alternative. He goes on to quote some impressive benchmarks from Rahul Bhargava, which show that multithreading gives at least 25% greater throughput that NIO, in a test with 1,700 concurrent connections.

Finally, here are the slides of an interesting presentation given by PaulTyma.