1 / 72

Communication

Communication. Chapter 2. Communication. Layered protocols Usual networking approach (client/server) Remote Procedure Call (RPC) Hide message passing details (client/server) Remote Method Invocation (RMI) Improved RPC (client/server). Communication. Message-Oriented Communications

powells
Download Presentation

Communication

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. Communication Chapter 2 Chapter 2  Communication 1

  2. Communication • Layered protocols • Usual networking approach (client/server) • Remote Procedure Call (RPC) • Hide message passing details (client/server) • Remote Method Invocation (RMI) • Improved RPC (client/server) Chapter 2  Communication 2

  3. Communication • Message-Oriented Communications • Message Passing  Low level, efficient • Message-Oriented Middleware (MOM)  Non client/server • Streams • Continuous flow subject to timing constraints Chapter 2  Communication 3

  4. Layered Protocols • OSI reference model • Each layer provides service to layer above • Implementation of service can change Chapter 2  Communication 4

  5. Layer Services • Transport layer • Logical connection between hosts • Reliable communication between hosts • Network layer • Route packet thru network • Data link layer • Get packet over each hop • Physical layer • Put the bits on the “wire” Chapter 2  Communication 5

  6. Layered Protocols • Layered message • Add headers when msg sent (down protocol stack) • Peel the onion when msg received (up the protocol stack) Chapter 2  Communication 6

  7. Data Link Layer • Communication at data link layer • Above, A tries to send msgs 0 and 1 to B Chapter 2  Communication 7

  8. Network Layer • On a LAN • Have a shared media • Put the packet out, recipient picks it up • On a WAN • Have point-to-point communication • Many possible routes • Finding best route is difficult Chapter 2  Communication 8

  9. Transport Layer • UDP for unreliable delivery • Better performance possible with UDP • TCP for reliable delivery • May be easier to build app with TCP Chapter 2  Communication 9

  10. Client-Server TCP Normal TCP Transactional TCP Chapter 2  Communication 10

  11. Middleware Protocols • Reference model for middleware based distributed communication Chapter 2  Communication 11

  12. What is Middleware? • Logically at application layer • General purpose protocols • Independent of an application • We’ll distinguish between • High level application and • Middleware Chapter 2  Communication 12

  13. Middleware Example • Often, must authenticate users • Require users prove identity • Spse you build authentication system • Any app can use your auth system • Your authentication “application” • Is at application layer in OSI • Is also at middleware layer in our view Chapter 2  Communication 13

  14. Middleware • Remainder of this chapter • 4 middleware communication services • RPC • RMI • Message oriented communication • Streaming Chapter 2  Communication 14

  15. Remote Procedure Call • Distributed systems can be built on explicit message passing • For example, send and receive • What’s wrong with this approach? • It’s not transparent to users • Why should we care? • Recall that transparency is one of primary goals in distributed systems Chapter 2  Communication 15

  16. Remote Procedure Call • RPC is a simple idea • Make remote operation seem like a (local) procedure call • “All the great things are simple”  Winston Churchill • Much better transparency compared to primitive message passing • Can we make remote operation seem local? Chapter 2  Communication 16

  17. Conventional Procedure Call • Stack before call to read • Stack while called procedure is active • Consider C function: count = read(fd, buf, bytes) Chapter 2  Communication 17

  18. Parameter Passing • Consider again • C function: count = read(fd, buf, bytes) • In C, parameters can be • Passed by value: bytes • Passed by reference: the array buf • Usually not important whether pass by value or pass by reference is used • But it’s a big deal in RPC! • Since procedure will execute at remote location Chapter 2  Communication 18

  19. RPC between Client/Server • We say that this is synchronous • Since client waits for result Chapter 2  Communication 19

  20. Stubs • On client side, stub marshalls parameters and send to server • Pack parameters into message(s) • On server side, stub converts to local procedure call, sends back results • Stubs increase transparency Chapter 2  Communication 20

  21. Passing Value Parameters • Suppose add(i,j) returns i + j • Remote computation via RPC Chapter 2  Communication 21

  22. Client Stub • Procedure • Stub marshalls params Chapter 2  Communication 22

  23. Steps in RPC • Client procedure calls client stub in normal way • Client stub builds message, calls local OS • Client's OS sends message to remote OS • Remote OS gives message to server stub • Server stub unpacks parameters, calls server • Server does work, returns result to the stub • Server stub packs it in message, calls local OS • Server's OS sends message to client's OS • Client's OS gives message to client stub • Stub unpacks result, returns to client Chapter 2  Communication 23

  24. Additional RPC Topics • Doors • Caller and sender on same machine • Asynchronous RPC • Client does something while server works on procedure • DCE RPC • Specific implementation of RPC Chapter 2  Communication 24

  25. Doors • If client and server on same machine • Use interprocess communication (IPC) • More efficient than network protocols Chapter 2  Communication 25

  26. The Doors • Doors are not to be confused with “The Doors” Chapter 2  Communication 26

  27. Asynchronous RPC • Usual (synchronous) RPC • Asynchronous RPC Chapter 2  Communication 27

  28. Asynchronous RPC • Client and server interact via two asynchronous RPCs • More efficient, if applicable Chapter 2  Communication 28

  29. DCE RPC • Distributed Computing Environment (DCE) • Read this section • A couple of interesting items… • DCE semantic options • At-most-once no call done more than once, even if system crash • Idempotent calls can be repeated multiple times (e.g., read) Chapter 2  Communication 29

  30. DCE RPC • Client-to-server binding in DCE • Note directory service Chapter 2  Communication 30

  31. RMI • Remote Method Invocation • Distributed objects • Objects hide internals • Provides transparency • Also desirable in distributed systems • RMI can increase transparency compared to RPC • Chapter 9 has real object systems Chapter 2  Communication 31

  32. Objects • Object encapsulates data, the state • Object encapsulates methods, operations on the data • Methods are made available thru well-defined interfaces • In distributed environment • Interface can be on one machine and • Corresponding object on another machine Chapter 2  Communication 32

  33. Distributed Objects • Interface on client • Proxy like client stub in RPC • Object on server • Skeleton like server stub in RPC Chapter 2  Communication 33

  34. Compile-time vs Runtime • Compile-time objects • Objects analogous to those in Java, C++ • Pluses: easy to implement • Minuses: depends on specific language • Runtime objects • Implementation is open, use adapter (wrapper) to hide implementation • Plus and minus opposite of those above Chapter 2  Communication 34

  35. RMI and Parameter Passing • Makes sense to treat local and remote objects differently • Lots of overhead to remote objects • Pass by reference gets complicated Chapter 2  Communication 35

  36. Java RMI • Distributed objects are an integral part of Java • Aims for high degree of transparency • For example client proxy has same interface as remote object • There are subtle differences between local and remote objects… Chapter 2  Communication 36

  37. Java RMI • Cloning • Cloning a local object results in exact copy • Only server can clone remote object • In Java, proxies not cloned • So must bind (again) to cloned object • Can declare method to be synchronized • Ensures access to data is serialized • Blocking • Clients blocked Chapter 2  Communication 37

  38. Java RMI • Read the details • A preview of Chapter 5… • Spse multiple clients want to access a method on server (method is synchronized) • Block all but one client  lots of overhead • Block at the server  what if client crashes? • Java restricts blocking to proxies • Simplifies things • But then can’t prevent simultaneous access of remote objects simply by synchronized Chapter 2  Communication 38

  39. Message-Oriented Comm. • RPC and RMI enhance transparency • But RPC and RMI are “inherently synchronous” • Consider an email system where • Messages stored on email servers when in transit and before read • Stored locally after read • Example of persistent communication Chapter 2  Communication 39

  40. Message-Oriented Comm. • In email example • Sender need not continue executing after sending msg • Receiver need not be executing when msg sent (to dest server) • Comparable to the Pony Express! • The more things change, the more they stay the same… Chapter 2  Communication 40

  41. Pony Express • Persistent comm. and the Pony Express Chapter 2  Communication 41

  42. Transient and Asynchronous • Transient • Msg is stored only as long as sender and receiver are alive • If msg can’t be delivered, discard it • Asynchronous • Sender does not wait for response before continuing • Recall persistent and synchronous • Four possible combinations… Chapter 2  Communication 42

  43. Examples • Transient asynchronous • UDP • Transient synchronous • Synchronous RPC • Persistent asynchronous • email • Persistent synchronous • Msg can only be stored at receiving host Chapter 2  Communication 43

  44. Persistence and Synchronicity • Persistent asynchronous communication • Persistent synchronous communication Chapter 2  Communication 44

  45. Persistence and Synchronicity • Transient asynchronous communication • Receipt-based transient synchronous communication Chapter 2  Communication 45

  46. Persistence and Synchronicity • Delivery-based transient synchronous communication at message delivery • Response-based transient synchronous communication Chapter 2  Communication 46

  47. Message-Oriented Comm. • Message-oriented systems take transient asynchronous as baseline • Like UDP • But persistence sometimes needed • Especially if geographically distributed • Network or process failures likely • Message passing like transport layer Chapter 2  Communication 47

  48. Message-Oriented Comm. • Transient • Berkeley sockets • Message Passing Interface (MPI) • Persistent • Message queuing model, MOM • Message brokers Chapter 2  Communication 48

  49. Berkeley Sockets • Socket primitives for TCP/IP Chapter 2  Communication 49

  50. Berkeley Sockets • Connection-oriented communication pattern using sockets • Note “synchronization point” Chapter 2  Communication 50

More Related