13 Remote Procedure Call 5 3 Outline Protocol

  • Slides: 23
Download presentation
13. Remote Procedure Call (5. 3) Outline Protocol Stack Presentation Formatting Spring 2001 1

13. Remote Procedure Call (5. 3) Outline Protocol Stack Presentation Formatting Spring 2001 1

RPC Timeline Client Server Reque st Blocked Computing Reply Blocked Spring 2001 2

RPC Timeline Client Server Reque st Blocked Computing Reply Blocked Spring 2001 2

RPC Components • Stubs Caller (client) Arguments Return value Arguments Server stub Client stub

RPC Components • Stubs Caller (client) Arguments Return value Arguments Server stub Client stub Request Callee (server) Reply RPC protocol Request Reply RPC protocol • Protocol Stack – BLAST: fragments and reassembles large messages – CHAN: synchronizes request and reply messages – SELECT: dispatches request to the correct process Spring 2001 3

Bulk Transfer (BLAST) • Unlike IP, tries to recover from lost fragments – still

Bulk Transfer (BLAST) • Unlike IP, tries to recover from lost fragments – still no guarantee of message delivery Sender Receiver Frag men t 1 Frag men Frag t 2 men t 3 Frag men t 4 men t 5 Frag • Strategy – selective retransmission (by SRR) – aka partial acknowledgements Spring 2001 men t 6 SRR Frag men t 3 Frag men t 5 SRR 4

BLAST Details • Sender: – after sending all fragments, set timer DONE – if

BLAST Details • Sender: – after sending all fragments, set timer DONE – if receive SRR, send missing fragments and reset DONE – if timer DONE expires, free fragments • Two possibilities Spring 2001 5

BLAST Details (cont) • Receiver: – when first fragments arrives, set timer LAST_FRAG –

BLAST Details (cont) • Receiver: – when first fragments arrives, set timer LAST_FRAG – when all fragments present, reassemble and pass up – four exceptional conditions: • if last fragment arrives but message not complete – send SRR and set timer RETRY • if timer LAST_FRAG expires – send SRR and set timer RETRY • if timer RETRY expires for first or second time – send SRR and set timer RETRY • if timer RETRY expires a third time – give up and free partial message Spring 2001 6

BLAST Header Format • • MID must protect against wrap around TYPE = DATA

BLAST Header Format • • MID must protect against wrap around TYPE = DATA or SRR Num. Frags indicates number of fragments Frag. Mask distinguishes among fragments – if Type=DATA, identifies this fragment – if Type=SRR, identifies missing fragments Spring 2001 7

Request/Reply (CHAN) • Guarantees message delivery • Synchronizes client with server • Supports at-most-once

Request/Reply (CHAN) • Guarantees message delivery • Synchronizes client with server • Supports at-most-once semantics Client Server Req uest ACK y Repl ACK Spring 2001 Implicit Acks Client Server Req uest 1 y 1 Repl Req uest 2 y 2 Repl … Simple case 8

CHAN Details • Lost message (request, reply, or ACK) – set RETRANSMIT timer –

CHAN Details • Lost message (request, reply, or ACK) – set RETRANSMIT timer – use message id (MID) field to distinguish • Slow (long running) server – client periodically sends “are you alive” probe, or – server periodically sends “I’m alive” notice • Want to support multiple outstanding calls – use channel id (CID) field to distinguish • Machines crash and reboot – use boot id (BID) field to distinguish Spring 2001 9

CHAN Header Format 0 • Type = REQ, REP, ACK, PROBE • CID =

CHAN Header Format 0 • Type = REQ, REP, ACK, PROBE • CID = Channel ID, 64 K concurrent logical channels between any pair of hosts • MID identifies each request/reply pair • BID = Boot ID, incremented each time the machine reboots Spring 2001 16 Type 31 CID MID BID Length Prot. Num Data 10

Dispatcher (SELECT) • Dispatch to appropriate procedure • Synchronous counterpart to UDP • Managing

Dispatcher (SELECT) • Dispatch to appropriate procedure • Synchronous counterpart to UDP • Managing Concurrency Client Server Callee x. Call SELECT x. Call. Demux SELECT x. Call CHAN x. Push x. Call. Demux CHAN x. Demux x. Push x. Demux • Address Space for Procedures – flat: unique id for each possible procedure – hierarchical: program + procedure number Spring 2001 11

Examples of Hierarchical Procedure Numbers • Program: file server, name server • Within file

Examples of Hierarchical Procedure Numbers • Program: file server, name server • Within file server: – 1: read, 2: write, 3: seek • Within name server: – 1: insert, 2: lookup Spring 2001 12

Simple RPC Stack SELECT CHAN BLAST IP ETH Spring 2001 13

Simple RPC Stack SELECT CHAN BLAST IP ETH Spring 2001 13

Sun. RPC • Sun’s Network File System (NFS) • IP implements BLAST-equivalent – except

Sun. RPC • Sun’s Network File System (NFS) • IP implements BLAST-equivalent – except no selective retransmit • Sun. RPC implements CHAN-equivalent – except not at-most-once • UDP + Sun. RPC implement SELECT-equivalent – UDP dispatches to program (ports bound to programs) – Sun. RPC dispatches to procedure within program Spring 2001 14

Sun. RPC • NFS Program number 0 x 00100003 – – Getattr: 1 Setattr:

Sun. RPC • NFS Program number 0 x 00100003 – – Getattr: 1 Setattr: 2 Read: 6 Write: 8 • Port Mapper: maps program numbers to port numbers – has a program number 0 x 00100000. – run at a well-know port number 111 Spring 2001 15

Sun. RPC Header Format • XID (transaction id) is similar to CHAN’s MID •

Sun. RPC Header Format • XID (transaction id) is similar to CHAN’s MID • Server does not remember last XID it serviced • Problem if client retransmits request while reply is in transit 0 31 XID Msg. Type = CALL Msg. Type = REPLY RPCVersion = 2 Status = ACCEPTED Program Data Version Procedure Credentials (variable) Verifier (variable) Data Spring 2001 16

Presentation Formatting (7. 1) • Marshalling (encoding) application data into messages • Unmarshalling (decoding)

Presentation Formatting (7. 1) • Marshalling (encoding) application data into messages • Unmarshalling (decoding) messages into application data Application data Presentation encoding Presentation decoding Message • Data types we consider – – – integers floats strings arrays structs Spring 2001 Message … Message • Types of data we do not consider – images – video – multimedia documents 17

Difficulties • Representation of base types – floating point: IEEE 754 versus non-standard –

Difficulties • Representation of base types – floating point: IEEE 754 versus non-standard – integer: big-endian versus little-endian (e. g. , 34, 677, 374) Big-endian (2) (17) 00000010 0001 (126) Little-endian 01111110 High address (34) (126) 0010 01111110 (34) (17) (2) 0010 0001 00000010 • Compiler layout of structures Spring 2001 Low address 18

Taxonomy • Data types – base types (e. g. , ints, floats); must convert

Taxonomy • Data types – base types (e. g. , ints, floats); must convert – flat types (e. g. , structures, arrays); must pack – complex types (e. g. , pointers); must linearize Application data structure Marshaller • Conversion Strategy – canonical intermediate form – receiver-makes-right (an N x N solution) Spring 2001 19

Taxonomy (cont) • Tagged versus untagged data type = INT len = 4 value

Taxonomy (cont) • Tagged versus untagged data type = INT len = 4 value = • Stubs – compiled – interpreted Call P 417892 Interface descriptor for Procedure P Arguments Client stub Code Specification Code Stub compiler Marshalled arguments P Arguments Server stub Marshalled arguments RPC Message Spring 2001 20

e. Xternal Data Representation (XDR) • • • Defined by Sun for use with

e. Xternal Data Representation (XDR) • • • Defined by Sun for use with Sun. RPC C type system (without function pointers) Canonical intermediate form Untagged (except array length) Compiled stubs Spring 2001 21

Abstract Syntax Notation One (ASN 1) • • • An ISO standard Essentially the

Abstract Syntax Notation One (ASN 1) • • • An ISO standard Essentially the C type system Canonical intermediate form Tagged Compiled or interpreted stubs BER: Basic Encoding Rules (tag, length, value) type length value Spring 2001 22

Network Data Representation (NDR) • Defined by DCE • Essentially the C type system

Network Data Representation (NDR) • Defined by DCE • Essentially the C type system • Receiver-makes-right (architecture tag) • Individual data items untagged • Compiled stubs from IDL • 4 -byte architecture tag Spring 2001 – Integer. Rep • 0 = big-endian • 1 = little-endian – Char. Rep • 0 = ASCII • 1 = EBCDIC – Float. Rep • • 0 = IEEE 754 1 = VAX 2 = Cray 3 = IBM 23