28
RPC Protocols HAN O SEOK

RPC protocols

  • Upload
    -

  • View
    364

  • Download
    0

Embed Size (px)

Citation preview

Page 1: RPC protocols

RPC ProtocolsHAN O SEOK

Page 2: RPC protocols

RPC

• Remote Procedure Calls

• Client-Server based Application

Page 3: RPC protocols

History

• Xerox - Courier

• Apollo Computer - Network Computing Architecture

• RPC ver. 1 (RFC 1050)

• RPC ver. 2 (RFC 5531)

Page 4: RPC protocols

How Works

Client Server

call rpc function

call service

service executes

request completes

return reply

progrma continues

execute requests

Page 5: RPC protocols

RPC Protocols

SOAP

XML-RPC

JSON-RPC

MSMQ

DTC

RMIThrift

Protocol BuffersAVRO

.NET Remoting

CORBA

Pyro

DRb

Page 6: RPC protocols

Interface Layer

• High Level Layer - Existed API Call

• Middle Level Layer - Create API By rpcgen Compiler

• Low Level Layer - Create RCP API

Page 7: RPC protocols

Network Layer & Data

XML ETC JSON

HTTP SOAPXML-RPC

XML-JSONavro

TCP/IP thriftProtoBuf

thriftavro

Named Pipe

IPX

Page 8: RPC protocols

XML-RPC

• HTTP Based POST Request

• Contents of Large Size

• Easy Implementation

Page 9: RPC protocols

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

Page 10: RPC protocols

Thrift on Java

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

• lib-thrift

• Support Thrift Server & Client

Page 11: RPC protocols

Thrift Type

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

• Structs

• Containerslist, set, map

• Exceptions

• Services

Page 12: RPC protocols

Thrift Stub Example

Page 13: RPC protocols

Thrift Stub Example

Page 14: RPC protocols

Thrift Stub Example

Page 15: RPC protocols

Thrift Request

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

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

• CompactProtocol?hellohanoseok

• BinaryProtocol

Page 16: RPC protocols

Avro

• HTTP, UDP, TCP Supports

• JSON

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

Page 17: RPC protocols

Avro differs

• Dynamic Typing - without code generation

• Untagged data - smaller serialization size by less type information

Page 18: RPC protocols

Avro Files

• .avpr : Protocol File

• .avsc : Schema File

• .genavro : Generate Avro File

Page 19: RPC protocols

Avro Stub Example

• Create Protocol File Using genavro File

Page 20: RPC protocols

Avro Stub Example

• Create Java Stup Using Protocol File

Page 21: RPC protocols

Avro Stub Example

Page 22: RPC protocols

Protocol Buffers

• ProtoBuf Runtime Only provides serialization and deserialization

• Just generate STUB

• Support Languages : C++, Java, Python

Page 23: RPC protocols

ProtoBuf Stub Example

Page 24: RPC protocols

ProtoBuf Stub Example

Page 25: RPC protocols

• ThriftCassandra, HBase, Evernote API, Facebook

• AvroCassandra, HBase

• Protocol BuffersGoogle Data Communications,Google App Engine

USING

Page 26: RPC protocols

Comparison

• Language Support : Thrift > Avro >ProtoBuf

• Scalability : ProtoBuf > Thrift > Avro

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

• Documenation : ProtoBuf > Avro = Thrift

Page 27: RPC protocols

Performance

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

Page 28: RPC protocols

Thanks