Apache Thrift is a very powerful framework which is used by popular Web administrators such as Facebook.
Thrift is a software framework for scalable cross-language services development. It combines a software stack with a code generation engine to build services that work efficiently and seamlessly between multiple programming languages.
So it basically allows us to write a code and then implement it in various other languages. Thrift has been written in C++ and it supports the following languages;
——————————————-
C++
C#
Erlang
Haskell
Java
Objective C/Cocoa
OCaml
Perl
PHP
Python
Ruby
Squeak
——————————————
1. We write files with .thrift extension in which we declare data (such as objects and procedure) which are to be passed between applications running on different languages.
2. Then we build the .thrift files for the language of our choice. For example, server side programming can be done with Java and client side programming using PHP.
3. Then create server and client side applications using the code generated above. Then the client should call for a procedure which has been implemented in the server side code and declared in thrift files.
4. At last you need to start the server and use client scripts to perform the actions.
Thrift can be used when your application relies on the client-server model. Also if you believe(as Facebook did), that some applications run better on some languages and you cannot to stick to one language for all your purpose.
Best of all, Thrift has been presented to open source community in April 2007 and entered the Apache Incubator in May, 2008. So now you can implement this on your server application.
It is possible to install Thrift on both Linux (CentOS and Ubuntu) and Windows. Though fairly simple to install, there are few GOTCHAS you need to be careful with while installing.
Want to know more on it this ? For all the coders out there, here is a reference site.
Thrift can be set up to use HTTP and JSON pretty easily if you want it (say if your client is somewhere on the internet and needs to pass firewalls) Thrift supports persistent connections and avoids the continuous TCP and HTTP handshakes that HTTP incurs.