Scalable Cross Language Services Implementation

Slides:



Advertisements
Similar presentations
2006 Pearson Education, Inc. All rights reserved Object-Oriented Programming: Polymorphism.
Advertisements

Client Tools Explained EAE 3014
Distributed Systems Architectures
Chapter 7 System Models.
Copyright © 2003 Pearson Education, Inc. Slide 8-1 Created by Cheryl M. Hughes, Harvard University Extension School Cambridge, MA The Web Wizards Guide.
Chapter 7 Constructors and Other Tools. Copyright © 2006 Pearson Addison-Wesley. All rights reserved. 7-2 Learning Objectives Constructors Definitions.
Copyright © 2003 Pearson Education, Inc. Slide 1 Computer Systems Organization & Architecture Chapters 8-12 John D. Carpinelli.
1 Copyright © 2013 Elsevier Inc. All rights reserved. Chapter 1 Embedded Computing.
Document #07-2I RXQ Customer Enrollment Using a Registration Agent (RA) Process Flow Diagram (Move-In) (mod 7/25 & clean-up 8/20) Customer Supplier.
By Rick Clements Software Testing 101 By Rick Clements
1 Hyades Command Routing Message flow and data translation.
Jeff Mischkinsky Nickolas Kavantzas Goran Olsson Web Services Choreography.
Writing Pseudocode And Making a Flow Chart A Number Guessing Game
18 Copyright © 2005, Oracle. All rights reserved. Distributing Modular Applications: Introduction to Web Services.
11 Copyright © 2005, Oracle. All rights reserved. Creating the Business Tier: Enterprise JavaBeans.
1 Copyright © 2005, Oracle. All rights reserved. Introducing the Java and Oracle Platforms.
8 Copyright © 2005, Oracle. All rights reserved. Creating the Web Tier: JavaServer Pages.
Properties of Real Numbers CommutativeAssociativeDistributive Identity + × Inverse + ×
Communicating over the Network
Excel Functions. Part 1. Introduction 2 An Excel function is a formula or a procedure that is performed in the Visual Basic environment, outside the.
Auto-scaling Axis2 Web Services on Amazon EC2 By Afkham Azeez.
Server Access The REST of the Story David Cleary
Written by Liron Blecher
Solve Multi-step Equations
REVIEW: Arthropod ID. 1. Name the subphylum. 2. Name the subphylum. 3. Name the order.
Chapter 1: Introduction to Scaling Networks
The Platform as a Service Model for Networking Eric Keller, Jennifer Rexford Princeton University INM/WREN 2010.
GETTING STARTED WITH WINDOWS COMMUNICATION FOUNDATION 4.5 Ed Jones & Grey Guindon.
Service Providers Last Update Copyright Kenneth M. Chipps Ph.D. 1.
ITEC200 Week04 Lists and the Collection Interface.
EU market situation for eggs and poultry Management Committee 20 October 2011.
EIS Bridge Tool and Staging Tables September 1, 2009 Instructor: Way Poteat Slide: 1.
The Modular Structure of Complex Systems Team 3 Nupur Choudhary Aparna Nanjappa Mark Zeits.
By Waqas Over the many years the people have studied software-development approaches to figure out which approaches are quickest, cheapest, most.
Copyright 2007, Information Builders. Slide 1 Introduction to Web Services Efrem Litwin Director, WebFOCUS Integration Products Information Builders.
CS 6143 COMPUTER ARCHITECTURE II SPRING 2014 ACM Principles and Practice of Parallel Programming, PPoPP, 2006 Panel Presentations Parallel Processing is.
Chapter 11: The X Window System Guide To UNIX Using Linux Third Edition.
VOORBLAD.
Object-Oriented Programming. 2 An object, similar to a real-world object, is an entity with certain properties, and with the ability to react in certain.
IONA Technologies Position Paper Constraints and Capabilities for Web Services
©2007 First Wave Consulting, LLC A better way to do business. Period This is definitely NOT your father’s standard operating procedure.
31242/32549 Advanced Internet Programming Advanced Java Programming
© 2012 National Heart Foundation of Australia. Slide 2.
Executional Architecture
Implementation Architecture
Global Analysis and Distributed Systems Software Architecture Lecture # 5-6.
Macromedia Dreamweaver MX 2004 – Design Professional Dreamweaver GETTING STARTED WITH.
Copyright © 2003 by Prentice Hall Computers: Tools for an Information Age Chapter 15 Programming and Languages: Telling the Computer What to Do.
Chapter 10: The Traditional Approach to Design
Systems Analysis and Design in a Changing World, Fifth Edition
©Brooks/Cole, 2001 Chapter 12 Derived Types-- Enumerated, Structure and Union.
Intracellular Compartments and Transport
PSSA Preparation.
©Ian Sommerville 2004Software Engineering, 7th edition. Chapter 13 Slide 1 Application architectures.
Introduction to ikhlas ikhlas is an affordable and effective Online Accounting Solution that is currently available in Brunei.
Introduction Peter Dolog dolog [at] cs [dot] aau [dot] dk Intelligent Web and Information Systems September 9, 2010.
From Model-based to Model-driven Design of User Interfaces.
TCP/IP Protocol Suite 1 Chapter 18 Upon completion you will be able to: Remote Login: Telnet Understand how TELNET works Understand the role of NVT in.
CS490T Advanced Tablet Platform Applications Network Programming Evolution.
Introduction to the Enterprise Library. Sounds familiar? Writing a component to encapsulate data access Building a component that allows you to log errors.
T Network Application Frameworks and XML Web Services and WSDL Sasu Tarkoma Based on slides by Pekka Nikander.
CS 390- Unix Programming Environment CS 390 Unix Programming Environment Topics to be covered: Distributed Computing Fundamentals.
1 Geospatial and Business Intelligence Jean-Sébastien Turcotte Executive VP San Francisco - April 2007 Streamlining web mapping applications.
S imple O bject A ccess P rotocol Karthikeyan Chandrasekaran & Nandakumar Padmanabhan.
S O A P ‘the protocol formerly known as Simple Object Access Protocol’ Team Pluto Bonnie, Brandon, George, Hojun.
CORBA Alegria Baquero.
CORBA Alegria Baquero.
Presented By: Kwangsung Oh
Presentation transcript:

Scalable Cross Language Services Implementation Thrift Scalable Cross Language Services Implementation Sanjoy Singh Senior Team Lead Talentica S/W (I) Pvt Ltd

Scalability ?? Design/Program is said to scale … - if it is suitably efficient and practical when applied to large situations Measures Load Functional

Agenda Key Components/Challenges for Cross Language Interactions Various System for Cross Language Interactions Dive Into Apache Thrift Principle Of Operation Example Thrift Stack Versioning Why to use Thrift. Limitations? Quick Code Walkthrough

LAMP + Services High-Level Goal: Enable transparent interaction between these. …and some others too.

High Level Goals ! Transparent Interaction between multiple programming languages. Maintain Right balance between Performance Ease and speed of development Availability of existing libraries. etc

Simple Distributed Architecture Sending requests, getting results Waiting for requests (known location, known port) Communication protocol, Data format Basic questions are: What kind of protocol to use, and what data to transmit What to do with requests on the server side

Key Components/Challenges ! Type system Transport system Protocol system Versioning Processor Performance No problem can stand the assault of sustained thinking.

Hasn’t this been done before? (yes.)‏ SOAP CORBA COM Pillar Protocol Buffers etc

Should we pick up one of those? (not sure)‏ SOAP XML, XML, and more XML CORBA Over designed and Heavyweight COM Embraced mainly in Windows Client Software Pillar Slick! But no versioning/abstraction. Protocol Buffers etc Closed source Google deliciousness

Decision Time ! As a developer, what are you looking for? Be Patient, I have something for you in the subsequent slides !!

Solution Apache Thrift Software framework for scalable cross-language services development.

Apache Thrift - Introduction Originally developed at Facebook Open sourced in April 2007 Easy exchange of data Cross language serialization with minimal overhead . Thrift tools can generate code for C++, Java, Python, PHP, Ruby, Erlang, Perl, Haskell, C#, Cocoa, Smalltalk and OCaml

Lets Dive It..

Principle Of Operation Define Data types and Service interfaces Create a thrift file eg demo.thrift Build Thrift platform files Thrift Code Generator Tool (written in C++) Demo.php Demo.cpp Demo.py Demo.java First of all, in *.thrift file you declare objects and procedures, that you would like to interchange between applications written in different languages. Then, using thrift tool, you build Thrift platform files for programming languages of your choice. Most important step is to create server and client applications, using code generated in the previous step. Server application should implement procedures declared in the thrift file, while client should call them. Thrift itself takes care about creating transport classes, defining objects, etc. so your responsibility is only to use them in your code. Last, but not least :) is to run your server. Then, using client script, you can perform actions using previously defined objects and methods. Server implements Services and Client calls them Create Server/Client App Run the Server

Thrift Cares About Thrift Doesn’t Care About Type Definitions Service Definitions Thrift Doesn’t Care About Wire Protocol (internal XML...) Transport (HTTP? Sockets? Whatevz!) Programming Languages

Enough Banter. Show Us the Goodz. // Include other thrift files include "shared.thrift“ namespace java calculator enum Operation { // define enums ADD = 1, SUBTRACT = 2, MULTIPLY = 3, DIVIDE = 4 } struct Work {// complex data structures 1: i32 num1 = 0, 2: i32 num2, 3: Operation op, 4: optional string comment,

Enough Banter. Show Us the Goodz. // Exception exception InvalidOperation { 1: i32 what, 2: string why } // Service service Calculator extends shared.SharedService { void ping(), i32 add(1:i32 num1, 2:i32 num2), i32 calculate(1:i32 logid, 2:Work w) throws (1:InvalidOperation ouch), oneway void zip()

Enough Banter. Show Us the Goodz. // Include other thrift files include "shared.thrift“ namespace java calculator enum Operation { // define enums ADD = 1, SUBTRACT = 2, MULTIPLY = 3, DIVIDE = 4 } struct Work {// complex data structures 1: i32 num1 = 0, 2: i32 num2, 3: Operation op, 4: optional string comment, // Exception exception InvalidOperation { 1: i32 what, 2: string why } // Service service Calculator extends shared.SharedService { void ping(), i32 add(1:i32 num1, 2:i32 num2), i32 calculate(1:i32 logid, 2:Work w) throws (1:InvalidOperation ouch), oneway void zip()

What DOES that do? Generates definitions for all the types in each language Generates Client and Server interfaces for each language What DOESNT that do? Anything to do with sockets Anything to do with serialization

Magically Generated Files gen-java/calculatordemo Calculator.java InvalidOperation.java Operation.java Work.java gen-php/ Calculator.php calculator_types gen-py/ ttypes.py Calculator.py Calculator-remote

Thrift Philosophy Create a system that is abstracted in a systematic way, such that developers can easily extend it to suit their needs and function in custom environments.

Structs don’t have any code to do with serialization or sockets, etc. But they know how to read and write themselves… How does that work?

The Thrift Stack The Thrift stack is a common class hierarchy implemented in each language that abstracts out the tricky details of protocol encoding and network communication. It provides a simple interface for generated code to use. There are two key interfaces: TTransport De-coupled the transport layer from Code Generation Layer. Provides read() and write(), with a set of other helpers like open(), close(), etc. Implementation - TSocket, TFileTransport, TBufferedTransport, TFramedTransport, TMemoryBuffer. TProtocol Separate Data Structure from Transport representation. Provides the ability to read and write various types of data, i.e. readI32(), writeString(), etc. Supports Bi-directional sequenced messaging and encoding of base types, container and struts.

The Thrift Stack Object write() Object read() Information Flow! TProtocol TTransport TTransport TProtocol

Versioning (applications change a lot, not protocols!) What happens when definitions change? Struct needs a new member Function needs a new argument No Problem! We’ve got Field Identifiers! Example: struct Work { 1: i32 num1 = 0, 2: i32 num2, 3: Operation op, 4: optional string comment, }

Versioning - Case Analysis Add a Field New Client, Old Server Server sees a field id that it doesn’t recognize, and safely ignores it. Old Client, New Server Server doesn’t see the field id it expects. Leaves it unset in object, server implementation can properly handle Remove a Field Server doesn’t see field it expects. Analogous to above. Old client sends deprecated field. Server politely ignore it. Analogous to the top case.

Why to use Thrift … Less time wasted by individual developers No duplicated networking and protocol code less time dealing with boilerplate stuff Write your client and server in about 5 minutes Less maintenance One networking code base that needs maintenance Fix bugs once, rather than repeatedly in every server Division of labour Work on high-performance servers separate from applications Common toolkit Code reuse and shared tools

Why to use Thrift … Cross-language serialization with lower overhead than alternatives such as SOAP due to use of binary format A lean and clean library. No framework to code to. No XML configuration files. The language bindings feel natural. For example Java uses ArrayList<String>. C++ uses std::vector<std::string>. The application-level wire format and the serialization-level wire format are cleanly separated. They can be modified independently.

Why to use Thrift … The predefined serialization styles include: binary, HTTP-friendly and compact binary. Soft versioning of the protocol. No build dependencies or non-standard software. No mix of incompatible software licenses.

Limitations / Non-Features Is struct inheritance/polymorphism supported? No, it isn’t Can I overload service methods? Nope. Method names must be unique. Heterogeneous containers Not supported Is there any enough documentation on Thrift development? I think this is one weak area.

Steps/Code Walkthrough (Lets build the example described earlier)

Some Real Time Example Facebook Search Service AdServer, Blogfeeds, CSSParser, Memcached, Network Selector, News Feed, Scribe etc Search Service (implemented in C++ PHP based Web App Thrift PHP Lib

Why Should I not try this? Guess the answer? Answer: Please do let me know at sanjoys@talentica.com Skpe_id/Gtalk_id : sanjoy_17 /sanjoy17

References http://incubator.apache.org/thrift/ http://incubator.apache.org/thrift/static /thrift-20070401.pdf

Thanks !!!