1 / 32

Lightweight RPCs

Lightweight RPCs. Many RPCs occur between client and server on same machine Need to optimize RPCs for this special case => use a lightweight RPC mechanism (LRPC) Server S exports interface to remote procedures Client C on same machine imports interface

alijah
Download Presentation

Lightweight RPCs

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Lightweight RPCs • Many RPCs occur between client and server on same machine • Need to optimize RPCs for this special case => use a lightweight RPC mechanism (LRPC) • Server S exports interface to remote procedures • Client C on same machine imports interface • OS kernel creates data structures including an argument stack shared between S and C CS677: Distributed OS

  2. Lightweight RPCs • RPC execution • Push arguments onto stack • Trap to kernel • Kernel changes mem map of client to server address space • Client thread executes procedure (OS upcall) • Thread traps to kernel upon completion • Kernel changes the address space back and returns control to client • Called “doors” in Solaris CS677: Distributed OS

  3. Doors • Which RPC to use? - run-time bit allows stub to choose between LRPC and RPC CS677: Distributed OS

  4. Other RPC Models • Asynchronous RPC • Request-reply behavior often not needed • Server can reply as soon as request is received and execute procedure later • Deferred-synchronous RPC • Use two asynchronous RPCs • Client needs a reply but can’t wait for it; server sends reply via another asynchronous RPC • One-way RPC • Client does not even wait for an ACK from the server • Limitation: reliability not guaranteed (Client does not know if procedure was executed by the server). CS677: Distributed OS

  5. Asynchronous RPC • The interconnection between client and server in a traditional RPC • The interaction using asynchronous RPC 2-12 CS677: Distributed OS

  6. Deferred Synchronous RPC • A client and server interacting through two asynchronous RPCs 2-13 CS677: Distributed OS

  7. Remote Method Invocation (RMI) • RPCs applied to objects, i.e., instances of a class • Class: object-oriented abstraction; module with data and operations • Separation between interface and implementation • Interface resides on one machine, implementation on another • RMIs support system-wide object references • Parameters can be object references CS677: Distributed OS

  8. Distributed Objects • When a client binds to a distributed object, load the interface (“proxy”) into client address space • Proxy analogous to stubs • Server stub is referred to as a skeleton CS677: Distributed OS

  9. Proxies and Skeletons • Proxy: client stub • Maintains server ID, endpoint, object ID • Sets up and tears down connection with the server • [Java:] does serialization of local object parameters • In practice, can be downloaded/constructed on the fly (why can’t this be done for RPCs in general?) • Skeleton: server stub • Does deserialization and passes parameters to server and sends result to proxy CS677: Distributed OS

  10. Binding a Client to an Object Distr_object* obj_ref; //Declare a systemwide object referenceobj_ref = …; // Initialize the reference to a distributed objectobj_ref-> do_something(); // Implicitly bind and invoke a method (a) Distr_object objPref; //Declare a systemwide object referenceLocal_object* obj_ptr; //Declare a pointer to local objectsobj_ref = …; //Initialize the reference to a distributed objectobj_ptr = bind(obj_ref); //Explicitly bind and obtain a pointer to the local proxyobj_ptr -> do_something(); //Invoke a method on the local proxy (b) • (a) Example with implicit binding using only global references • (b) Example with explicit binding using global and local references CS677: Distributed OS

  11. Parameter Passing • Less restrictive than RPCs. • Supports system-wide object references • [Java] pass local objects by value, pass remote objects by reference CS677: Distributed OS

  12. DCE Distributed-Object Model • Distributed dynamic objects in DCE. • Distributed named objects CS677: Distributed OS

  13. Java RMI • Server • Defines interface and implements interface methods • Server program • Creates server object and registers object with “remote object” registry • Client • Looks up server in remote object registru • Uses normal method call syntax for remote methos • Java tools • Rmiregistry: server-side name server • Rmic: uses server interface to create client and server stubs CS677: Distributed OS

  14. Java RMI and Synchronization • Java supports Monitors: synchronized objects • Serializes accesses to objects • How does this work for remote objects? • Options: block at the client or the server • Block at server • Can synchronize across multiple proxies • Problem: what if the client crashes while blocked? • Block at proxy • Need to synchronize clients at different machines • Explicit distributed locking necessary • Java uses proxies for blocking • No protection for simultaneous access from different clients • Applications need to implement distributed locking CS677: Distributed OS

  15. Persistence and Synchronicity in Communication • General organization of a communication system in which hosts are connected through a network 2-20 CS677: Distributed OS

  16. Persistence • Persistent communication • Messages are stored until (next) receiver is ready • Examples: email, pony express CS677: Distributed OS

  17. Persistence • Transient communication • Message is stored only so long as sending/receiving application are executing • Discard message if it can’t be delivered to next server/receiver • Example: transport-level communication services offer transient communication • Example: Typical network router – discard message if it can’t be delivered next router or destination CS677: Distributed OS

  18. Synchronicity • Asynchronous communication • Sender continues immediately after it has submitted the message • Need a local buffer at the sending host • Synchronous communication • Sender blocks until message is stored in a local buffer at the receiving host or actually delivered to sending • Variant: block until receiver processes the message • Six combinations of persistence and synchronicity CS677: Distributed OS

  19. Persistence and Synchronicity Combinations • Persistent asynchronous communication (e.g., email) • Persistent synchronous communication 2-22.1 CS677: Distributed OS

  20. Persistence and Synchronicity Combinations • Transient asynchronous communication (e.g., UDP) • Receipt-based transient synchronous communication 2-22.2 CS677: Distributed OS

  21. Persistence and Synchronicity Combinations • Delivery-based transient synchronous communication at message delivery (e.g., asynchronous RCP) • Response-based transient synchronous communication (RPC) CS677: Distributed OS

  22. Message-oriented Transient Communication • Many distributed systems built on top of simple message-oriented model • Example: Berkeley sockets CS677: Distributed OS

  23. Berkeley Socket Primitives CS677: Distributed OS

  24. Message-Passing Interface (MPI) • Sockets designed for network communication (e.g., TCP/IP) • Support simple send/receive primitives • Abstraction not suitable for other protocols in clusters of workstations or massively parallel systems • Need an interface with more advanced primitives • Large number of incompatible proprietary libraries and protocols • Need for a standard interface • Message-passing interface (MPI) • Hardware independent • Designed for parallel applications (uses transient communication) • Key idea: communication between groups of processes • Each endpoint is a (groupID, processID) pair CS677: Distributed OS

  25. MPI Primitives CS677: Distributed OS

  26. Message-oriented Persistent Communication • Message queuing systems • Support asynchronous persistent communication • Intermediate storage for message while sender/receiver are inactive • Example application: email • Communicate by inserting messages in queues • Sender is only guaranteed that message will be eventually inserted in recipient’s queue • No guarantees on when or if the message will be read • “Loosely coupled communication” CS677: Distributed OS

  27. Message-Queuing Model CS677: Distributed OS

  28. Stream Oriented Communication • Message-oriented communication: request-response • When communication occurs and speed do not affect correctness • Timing is crucial in certain forms of communication • Examples: audio and video (“continuous media”) • 30 frames/s video => receive and display a frame every 33ms • Characteristics • Isochronous communication • Data transfers have a maximum bound on end-end delay and jitter • Push mode: no explicit requests for individual data units beyond the first “play” request CS677: Distributed OS

  29. Examples Single sender and receiver One sender Multiple receivers CS677: Distributed OS

  30. Quality of Service (QoS) • Time-dependent and other requirements are specified as quality of service (QoS) • Requirements/desired guarantees from the underlying systems • Application specifies workload and requests a certain service quality • Contract between the application and the system CS677: Distributed OS

  31. Specifying QoS: Token bucket • The principle of a token bucket algorithm • Parameters (rate r, burst b) • Rate is the average rate, burst is the maximum number of packets that can arrive simultaneously CS677: Distributed OS

  32. Setting Up a Stream: RSVP CS677: Distributed OS

More Related