Evolution of Facebook Thrift: Improving Cross-Language Communication

Slide Note
Embed
Share

Facebook Thrift is a software library developed by Facebook to facilitate efficient backend service development. Originally created to address resource demands, it enables seamless communication across multiple programming languages while abstracting language-specific customizations. This advancement allowed Facebook to transcend limitations imposed by the LAMP framework, promoting transparent interaction and accelerating development cycles. The core components of Thrift include base types and containers to support diverse data structures.


Uploaded on Oct 04, 2024 | 0 Views


Download Presentation

Please find below an Image/Link to download the presentation.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author. Download presentation by click this link. If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.

E N D

Presentation Transcript


  1. FACEBOOK THRIFT SHRUTHI MOHANAN TE-IT ROLL NO:43142 GUIDE: PROF.SHUCHI GUPTA FACEBOOK THRIFT 1

  2. CONTENTS THRIFT FACEBOOK THRIFT GOALS TYPES OF THRIFT VERSIONING TRANSPORT IMPLEMENTATION OF TRANSPORT IN THRIFT TARGET LANGUAGES IN THRIFT IMPLEMENTATION FACEBOOK SERVICES WITH THRIFT THRIFT USAGES 2 FACEBOOK THRIFT

  3. THRIFT Thrift -software library Origin To expedite development and implementation of scalable and efficient backend services. The primary goal of thrift - communication across programming languages It abstracts the portions of each language that tend to require the most customization into a common library that is implemented in each language. 3 FACEBOOK THRIFT

  4. FACEBOOK THRIFT Evolution of Thrift- A new direction was required to tackle the resource demands problems for many of Facebook's on-site applications. Some couldn t be addressed by staying within the LAMP framework. LAMP is the acronym for Linux, MySQL, Apache and PHP. 4 FACEBOOK THRIFT

  5. GOALS Transparent Interaction between multiple programming languages. Maintain Right balance between Performance Ease and speed of development Availability of existing libraries 5 FACEBOOK THRIFT

  6. LAMP ENABLE TRANSPARENT INTERACTION BETWEEN THESE 6 FACEBOOK THRIFT

  7. TYPES OF THRIFT BASE TYPES CONTAINERS 7 FACEBOOK THRIFT

  8. BASE TYPES The type system rests upon a few base types. The base types supported by Thrift are: bool A boolean value, true or false byte A signed byte i16 A 16-bit signed integer i32 A 32-bit signed integer i64 A 64-bit signed integer double A 64-bit floating point number string An encoding-agnostic text or binary string 8 FACEBOOK THRIFT

  9. CONTAINERS IN THRIFT Stores collection of other objects(elements). They are annotated using the C++ template. There are three types available: list<type> An ordered list of elements. set<type> An unordered set of unique elements map<type1,type2> A map of strictly unique keys to values. 9 FACEBOOK THRIFT

  10. VERSIONING Datatypes themselves without any interruption in service. There are mainly two types of versioning used in thrift implementation, namely: must be able to version 1) ISSET 2) FIELD IDENTIFIERS 10 FACEBOOK THRIFT

  11. ISSET Determine if a variable is set and is not null. This is implemented via an inner isset structure inside the defined objects. When a reader receives a struct, it should check for a field being set before operating directly on it. 11 FACEBOOK THRIFT

  12. FIELD IDENTIFIERS Versioning in Thrift is implemented via field identifiers. The field header for every member of a struct in Thrift is encoded with a unique field identifier. The combination of this field identifier and it type specifier is used to uniquely identify the field. 12 FACEBOOK THRIFT

  13. FIELD IDENTIFIERS The Thrift definition language supports automatic assignment of field identifiers. Good programming practice-always explicitly specify field identifiers. Identifiers are specified as follows: struct Example { 1:i32 number=10, 2:i64 bigNumber, 3:double decimals, 4:string name="thrifty" } 13 FACEBOOK THRIFT

  14. TRANSPORT The generated Thrift code only needs to know how to read and write data. The origin and destination of the data are irrelevant. It may be a socket, a segment of shared memory, or a file on the local disk. 14 FACEBOOK THRIFT

  15. TRANSPORT The Thrift transport interface supports the following methods: open - Opens the transport close - Closes the transport isOpen - Indicates whether the transport is open Read - Reads from the transport write -Writes to the transport flush - Forces any pending writes 15 FACEBOOK THRIFT

  16. IMPLEMENTATION OF TRANSPORT The transport interface is designed for simple implementation in any programming language. New transport mechanisms can be easily defined as needed by application developers. TYPES: 1.TFILE TRANSPORT It can be used to write out a set of incoming Thrift requests to a file on disk. 2.UTILITIES Utilities include the TBufferedTransport, which buffers the writes and reads on an underlying transport. 16 FACEBOOK THRIFT

  17. TARGET LANGUAGES IN THRIFT IMPLEMENTATION Thrift currently supports five target languages : C, C++, Java, Python, Ruby, and PHP. The Thrift services implemented in PHP has also been embedded into Apache web server, providing the transparent backend access. 17 FACEBOOK THRIFT

  18. FACEBOOK SERVICES Thrift has been employed in a large number of applications at Facebook. The two specific usages are: 1.SEARCH 2.LOGGING 18 FACEBOOK THRIFT

  19. SEARCH Multi-language code generation Well suited for search Allows for application development in an efficient server side language (C++) and allows the Facebook application. Make calls to the search service using Thrift PHP libraries. PHP-based web 19 FACEBOOK THRIFT

  20. SEARCH 20 FACEBOOK THRIFT

  21. LOGGING The Thrift TFile Transport functionality is used for structured logging. This log can then be used for a variety of purposes, including inline and offline processing. 21 FACEBOOK THRIFT

  22. LOGGING PAGE OF FACEBOOK 22 FACEBOOK THRIFT

  23. THRIFT EXTENSABILITY Thrift has been added to Apache Software Foundation as the Apache Thrift Project , making it open source framework for cross- language service implementation. 23 FACEBOOK THRIFT

  24. APACHE THRIFT ARCHITECTURE 24 FACEBOOK THRIFT

  25. CONCLUSION Thrift has enabled Facebook to build scalable backend services efficiently by enabling engineers to divide and conquer. Thrift has been employed in a wide variety of applications at Facebook, including search, logging, mobile, ads, and the developer platform. 25 FACEBOOK THRIFT

  26. REFERENCES A. Acquisti. Privacy in electronic commerce and the economics of immediate gratification. In Proceedings of the ACM Conference on Electronic Commerce (EC 04). Thrift: Scalable Cross-Language Services Implementation, Mark Slee, Aditya Agarwal and Marc Kwiatkowski,Facebook, Palo Alto, CA Kempf, William, Boost.Threads , http://www.boost.org/doc/html/threads.html Henkel, Philipp, thread pool , http://threadpool.sourceforge.net 26 FACEBOOK THRIFT

  27. 27 FACEBOOK THRIFT

  28. 28 FACEBOOK THRIFT

Related


More Related Content