RPC protocols

Preview:

Citation preview

RPC ProtocolsHAN O SEOK

RPC

• Remote Procedure Calls

• Client-Server based Application

History

• Xerox - Courier

• Apollo Computer - Network Computing Architecture

• RPC ver. 1 (RFC 1050)

• RPC ver. 2 (RFC 5531)

How Works

Client Server

call rpc function

call service

service executes

request completes

return reply

progrma continues

execute requests

RPC Protocols

SOAP

XML-RPC

JSON-RPC

MSMQ

DTC

RMIThrift

Protocol BuffersAVRO

.NET Remoting

CORBA

Pyro

DRb

Interface Layer

• High Level Layer - Existed API Call

• Middle Level Layer - Create API By rpcgen Compiler

• Low Level Layer - Create RCP API

Network Layer & Data

XML ETC JSON

HTTP SOAPXML-RPC

XML-JSONavro

TCP/IP thriftProtoBuf

thriftavro

Named Pipe

IPX

XML-RPC

• HTTP Based POST Request

• Contents of Large Size

• Easy Implementation

Thrift

• Facebook (By X-Googler)

• Numbers of Language Support

C++, C#, Java, Erlang, Haskell, Objective C, Perl, PHP, Python, Ruby, SqueakJavascript, Node.js, Smalltalk, OCaml

Thrift on Java

• Ivy (http://ant.apache.org/ivy/)

• lib-thrift

• Support Thrift Server & Client

Thrift Type

• Base Typesboolean, byte, i16, i32, i64 (Signed Integer)double, string

• Structs

• Containerslist, set, map

• Exceptions

• Services

Thrift Stub Example

Thrift Stub Example

Thrift Stub Example

Thrift Request

• JSONProtocol[1,”hello”,1,2,{“1”:”str”:hanoseok”}}]

• SimpleJSONProtocol[“hello”,1,1,{“name”:”hanoseok”}]

• CompactProtocol?hellohanoseok

• BinaryProtocol

Avro

• HTTP, UDP, TCP Supports

• JSON

• Support LanguagesC, C++, Java, Python, Ruby, PHP

Avro differs

• Dynamic Typing - without code generation

• Untagged data - smaller serialization size by less type information

Avro Files

• .avpr : Protocol File

• .avsc : Schema File

• .genavro : Generate Avro File

Avro Stub Example

• Create Protocol File Using genavro File

Avro Stub Example

• Create Java Stup Using Protocol File

Avro Stub Example

Protocol Buffers

• ProtoBuf Runtime Only provides serialization and deserialization

• Just generate STUB

• Support Languages : C++, Java, Python

ProtoBuf Stub Example

ProtoBuf Stub Example

• ThriftCassandra, HBase, Evernote API, Facebook

• AvroCassandra, HBase

• Protocol BuffersGoogle Data Communications,Google App Engine

USING

Comparison

• Language Support : Thrift > Avro >ProtoBuf

• Scalability : ProtoBuf > Thrift > Avro

• (De)Serialization Speed : thrift >= ProtoBuf >= Avro

• Documenation : ProtoBuf > Avro = Thrift

Performance

• https://github.com/eishay/jvm-serializers/wiki/

Thanks

Recommended