Distributed systems Lecture 11: Object-Oriented Middleware (OOM), clocks and distributed time. Dr. Robert N. M. Watson.

Similar documents
Distributed systems Lecture 3: Further RPC and OOM systems; Clocks

Distributed Systems: Advantages. Recommended Reading Reading. What are Distributed Systems? 8L for Part IB Handout 1. Distributed Systems

Dr. Robert N. M. Watson

Today: Distributed Objects. Distributed Objects

DS 2009: middleware. David Evans

Distributed Objects. Object-Oriented Application Development

Distributed Objects and Remote Invocation. Programming Models for Distributed Applications

Distributed Systems. Clock Synchronization: Physical Clocks. Paul Krzyzanowski

Lecture 5: Object Interaction: RMI and RPC

CORBA (Common Object Request Broker Architecture)

Distributed systems Lecture 2: Network File System and Object- Oriented Middleware. Dr. Robert N. M. Watson

Distributed Middleware. Distributed Objects

Last Eme. Distributed systems Lecture 2: Network File System and Object- Oriented Middleware. Dr. Robert N. M. Watson

MTAT Enterprise System Integration. Lecture 2: Middleware & Web Services

Remote Invocation. Today. Next time. l Overlay networks and P2P. l Request-reply, RPC, RMI

Distributed Systems Middleware

Distributed Object-Based Systems The WWW Architecture Web Services Handout 11 Part(a) EECS 591 Farnam Jahanian University of Michigan.

Outline. EEC-681/781 Distributed Computing Systems. The OSI Network Architecture. Inter-Process Communications (IPC) Lecture 4

Distributed Technologies - overview & GIPSY Communication Procedure

RPC flow. 4.3 Remote procedure calls IDL. RPC components. Procedure. Program. sum (j,k) int j,k; {return j+k;} i = sum (3,7); Local procedure call

Lecture 06: Distributed Object

MODELS OF DISTRIBUTED SYSTEMS

Chapter 4 Communication

Distributed Systems Lecture 2 1. External Data Representation and Marshalling (Sec. 4.3) Request reply protocol (failure modes) (Sec. 4.

Electronic Payment Systems (1) E-cash

Message Passing vs. Distributed Objects. 5/15/2009 Distributed Computing, M. L. Liu 1

1.264 Lecture 16. Legacy Middleware

Last Class: RPCs. Today:

CSci Introduction to Distributed Systems. Communication: RPC

Overview. Communication types and role of Middleware Remote Procedure Call (RPC) Message Oriented Communication Multicasting 2/36

RMI: Design & Implementation

COMMUNICATION PROTOCOLS: REMOTE PROCEDURE CALL (RPC)

MODELS OF DISTRIBUTED SYSTEMS

Remote Invocation Vladimir Vlassov and Johan Montelius

Chapter 5: Distributed objects and remote invocation

CS555: Distributed Systems [Fall 2017] Dept. Of Computer Science, Colorado State University

CHAPTER - 4 REMOTE COMMUNICATION

Lecture 15: Network File Systems

COMMUNICATION IN DISTRIBUTED SYSTEMS

Communication. Distributed Systems Santa Clara University 2016

UNIT 4 CORBA 4/2/2013 Middleware 59

Remote Invocation. To do. Request-reply, RPC, RMI. q Today q. q Next time: Indirect communication

IIOP: Internet Inter-ORB Protocol Make your code accessible even in future, with the next universal protocol

Web Services Architecture and Programming

Object-Oriented Distributed Technology

Introduction and Overview Socket Programming Higher-level interfaces Final thoughts. Network Programming. Samuli Sorvakko/Nixu Oy

Distributed Systems Principles and Paradigms. Distributed Object-Based Systems. Remote distributed objects. Remote distributed objects

Today: Distributed Middleware. Middleware

CS 162 Operating Systems and Systems Programming Professor: Anthony D. Joseph Spring Lecture 22: Remote Procedure Call (RPC)

RPC. Remote Procedure Calls. Robert Grimm New York University

Distributed Systems 8. Remote Procedure Calls

Remote Invocation. Today. Next time. l Indirect communication. l Request-reply, RPC, RMI

Software Paradigms (Lesson 10) Selected Topics in Software Architecture

Contents. Java RMI. Java RMI. Java RMI system elements. Example application processes/machines Client machine Process/Application A

Agent and Object Technology Lab Dipartimento di Ingegneria dell Informazione Università degli Studi di Parma. Distributed and Agent Systems

RIKA: Component Architectures

Distributed Systems Principles and Paradigms

RPC and RMI. 2501ICT Nathan

REMOTE PROCEDURE CALLS EE324

Introduction and Overview Socket Programming Lower-level stuff Higher-level interfaces Security. Network Programming. Samuli Sorvakko/Nixu Oy

CSCI-1680 RPC and Data Representation. Rodrigo Fonseca

Remote Method Invocation Benoît Garbinato

XML in the Development of Component Systems. XML Protocols: XML-RPC

Middleware. Adapted from Alonso, Casati, Kuno, Machiraju Web Services Springer 2004

Communication. Overview

15-498: Distributed Systems Project #1: Design and Implementation of a RMI Facility for Java

5 Distributed Objects: The Java Approach

Slides for Chapter 5: Remote Invocation

Operating Systems. 18. Remote Procedure Calls. Paul Krzyzanowski. Rutgers University. Spring /20/ Paul Krzyzanowski

Distributed Environments. CORBA, JavaRMI and DCOM

416 Distributed Systems. RPC Day 2 Jan 11, 2017

03 Remote invoaction. Request-reply RPC. Coulouris 5 Birrel_Nelson_84.pdf RMI

Verteilte Systeme (Distributed Systems)

Lecture 15: Frameworks for Application-layer Communications

DISTRIBUTED COMPUTER SYSTEMS

Lecture 15: Frameworks for Application-layer Communications

416 Distributed Systems. RPC Day 2 Jan 12, 2018

presentation DAD Distributed Applications Development Cristian Toma

CSE 124 Distributed programming and Remote Procedure Calls (RPC) February 23, 2016, UCSD Prof. George Porter

Remote Method Invocation. Benoît Garbinato

Introduction and Overview Socket Programming Higher-level interfaces Final thoughts. Network Programming. Samuli Sorvakko/Nixu Oy

Lecture 16. What is COM? Principles of COM. COM Design Principles. Example (UML Diagram) Microsoft IDL (MIDL) COM/DCOM February 23, 2005

INTRODUCTION TO XML-RPC, A SIMPLE XML-BASED RPC MECHANISM

Chapter 3 Introduction to Distributed Objects

KINGS COLLEGE OF ENGINEERING DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING ACADEMIC YEAR (ODD SEMESTER) QUESTION BANK

CSCI-1680 RPC and Data Representation John Jannotti

Lecture 8: February 19

Software Components and Distributed Systems

What is CORBA? CORBA (Common Object Request Broker Architecture) is a distributed object-oriented client/server platform.

Distributed Systems. The main method of distributed object communication is with remote method invocation

Networks and Operating Systems Chapter 3: Remote Procedure Call (RPC)

Distributed Systems Theory 4. Remote Procedure Call. October 17, 2008

(D)COM Microsoft s response to CORBA. Alessandro RISSO - PS/CO

Appendix A - Glossary(of OO software term s)

Advanced Topics in Operating Systems

CHAPTER 7 COM and.net

Chapter 10 Web-based Information Systems

A Report on RMI and RPC Submitted by Sudharshan Reddy B

CORBA and COM TIP. Two practical techniques for object composition. X LIU, School of Computing, Napier University

Remote Procedure Call

Transcription:

Distributed systems Lecture 11: Object-Oriented Middleware (OOM), clocks and distributed time Dr. Robert N. M. Watson 1 The story so far Distributed systems are hard Looking at simple client/server interaction, and use of Remote Procedure Call (RPC) invoking methods on server over the network middleware generates stub code which can marshal / unmarshal arguments and replies saw case study of NFS (RPC-based file system) Other RPC systems (e.g., DCE RPC) 2 1

Object-Oriented Middleware SunRPC / DCE RPC forward functions, and do not support complex types, exceptions, or polymorphism Object-Oriented Middleware (OOM) arose in the early 90s to address this Assume programmer is writing in OO-style (and language) Remote objects will behave like local objects, but they methods will be forwarded over the network a la RPC References to objects can be passed as arguments or return values e.g., passing a directory object reference (Promote NFS s concept of a handle into the framework) Makes it much easier to program especially if your program is already object oriented! 3 CORBA (1989) First OOM system was CORBA Common Object Request Broker Architecture specified by the OMG: Object Management Group OMA (Object Management Architecture) is the general model of how objects interoperate Objects provide services. Clients makes a request to an object for a service. Client doesn t need to know where the object is, or anything about how the object is implemented! Object interface must be known (public) 4 2

Object Request Broker (ORB) The ORB is the core of the architecture Connects clients to object implementations Conceptually spans multiple machines (in practice, ORB software runs on each machine) Client Generated Stub Code ORB Object Implementation Generated Skeleton Code 5 Invoking Objects Clients obtain an object reference Typically via the naming service or trading service (Object references can also be saved for use later) Interfaces defined by CORBA IDL Clients can call remote methods in 2 ways: 1. Static Invocation: using stubs built at compile time (just like with RPC) 2. Dynamic Invocation: actual method call is created on the fly. It is possible for a client to discover new objects at run time and access the object methods 6 3

CORBA IDL Definition of language-independent remote interfaces Language mappings to C++, Java, Smalltalk, Translation by IDL compiler Type system basic types: long (32 bit), long long (64 bit), short, float, char, boolean, octet, any, constructed types: struct, union, sequence, array, enum objects (common super type Object) Parameter passing in, out, inout (= send remote, modify, update) basic & constructed types passed by value objects passed by reference 7 CORBA Pros and Cons CORBA has some unique advantages Industry standard (OMG) Language & OS agnostic: mix and match Richer than simple RPC (e.g. interface repository, implementation repository, DLL support, ) Many additional services (trading & naming, events & notifications, security, transactions, ) However: Really, really complicated / ugly / buzzwordy Poor interoperability, at least at first Generally to be avoided unless you need it! 8 4

Microsoft DCOM (1996) An alternative to CORBA: MS had invested in COM (object-oriented local IPC scheme) so didn t fancy moving to OMA Service Control Manager (SCM) on each machine responsible for object creation, invocation,... essentially a lightweight ORB Added remote operation using MSRPC: based on DCE RPC, but extended to support objects augmented IDL called MIDL: DCE IDL + objects requests include interface pointer IDs (IPIDs) to identify object & interface to be invoked 9 DCOM vs. CORBA Both are language neutral, and object-oriented DCOM supports objects with multiple interfaces but not, like CORBA, multiple inheritance of interfaces DCOM handles distributed garbage collection: remote objects are reference counted (via explicit calls) ping protocol handles abnormal client termination DCOM is widely used (e.g. SMB/CIFS, RDP,... ) But DCOM is MS proprietary (not standard)... and no support for exceptions (return-code based).. and lacks many of CORBAs services (e.g. trading) Deprecated today in favor of.net 10 5

Java RMI 1995: Sun extended Java to allow RMI RMI = Remote Method Invocation Essentially an OOM scheme for Java with clients, servers and an object registry object registry maps from names to objects supports bind()/rebind(), lookup(), unbind(), list() RMI was designed for Java only no goal of OS or language interoperability hence cleaner design, tighter language integration E.g., distributed garbage collection 11 RMI: new classes remote class: one whose instances can be used remotely within home address space, a regular object within foreign address spaces, referenced indirectly via an object handle serializable class: [nothing to do with transactions!] object that can be marshalled/unmarshalled if a serializable object is passed as a parameter or return value of a remote method invocation, the value will be copied from one address space to another (for remote objects, only the object handle is copied) 12 6

RMI: new classes remote class: one whose instances can be used remotely needed for remote objects within home address space, a regular object within (when foreign address passing spaces, references) referenced indirectly via an object handle serializable class: object that can be marshalled/unmarshalled needed for parameters if a serializable object is passed as a parameter or return value (when of a remote passing method data) invocation, the value will be copied from one address space to another (for remote objects, only the object handle is copied) 13 RMI: the big picture client application lookup() remote reference registry bind() remote object implementation remote interface f(args) return/exception f(args) return/exn stub marshal stream stub Registry can be on server... or one per distributed system client and server can find it via the LocateRegistry class Objects being serialized are annotated with a URL for the class unless they implement Remote => replaced with a remote reference 14 7

Distributed garbage collection With RMI, can have local & remote object references scattered around a set of machines Build distributed garbage collection over local GC: When a server exports object O, it creates a skeleton S[O] When a client obtains a remote reference to O, it creates a proxy object P[O], and remotely invokes dirty(o) Local GC will track the liveness of P[O]; when it is locally unreachable, client remotely invokes clean(o) If server notices no remote references, can free S[O] If S[O] was last reference to O, then it too can be freed Like DCOM, server removes a reference if it doesn t hear from that client for a while (default 10 mins) 15 OOM: summary OOM enhances RPC with objects types, interfaces, exceptions, Seen CORBA, DCOM and Java RMI All plausible, and all still used today CORBA most general (language and OS agnostic), but also the most complex: design by committee DCOM is MS-only; being phased out for.net Java RMI decent starting point for simple distributed systems but lacks many features (EJB is a modern CORBA/RMI/<stuff> megalith) 16 8

XML-RPC Systems seen so far all developed by large industry, and work fine in the local area But don t (or didn t) do well through firewalls ;-) In 1998, Dave Winer developed XML-RPC Use XML to encode method invocations (method names, parameters, etc) Use HTTP POST to invoke; response contains the result, also encoded in XML Looks like a regular web session, and so works fine with firewalls, NAT boxes, transparent proxies, 17 XML-RPC example XML-RPC Request <?xml version="1.0"?> <methodcall> <methodname>util.inttostring</methodname> <params> <param> <value><i4>55</i4></value> </param> </params> </methodcall> XML-RPC Response <?xml version="1.0"?> <methodresponse> <params> <param> <value><string>fifty Five</string></value> </param> </params> </methodresponse> Client side names method (as a string), and lists parameters, tagged with simple types Server receives message (via HTTP), decodes, performs operation, and replies with similar XML Inefficient & weakly typed but simple, language agnostic, extensible, and eminently practical! 18 9

SOAP & web services XML-RPC was a victim of its own success WWW consortium decided to embrace it, extend it, and generally complify it up SOAP (Simple Object Access Protocol) is basically XML-RPC, but with more XML bits Support for namespaces, user-defined types, multihop messaging, recipient specification, Also allows transport over SMTP (!), TCP & UDP SOAP is part of the Web Services world As complex as CORBA, but with more XML ;-) 19 Moving away from RPC SOAP 1.2 defined in 2003 Less focus on RPC, and more on moving XML messages from A to B (perhaps via C & D) One major problem with all RPC schemes is that they were synchronous: Client is blocked until server replies Poor responsiveness, particularly in wide area 2006 saw introduction of AJAX Asynchronous Javascript with XML Chief benefit: can update web page without reloading Examples: Google Maps, Gmail, Google Docs, 20 10

Representational State Transfer (REST) AJAX still does RPC (just asynchronously) Is a procedure call / method invocation really the best way to build distributed systems? Representational State Transfer (REST) is an alternative paradigm (or a throwback?) Resources have a name: URL or URI Manipulate them via POST (create), GET (select), PUT (create/overwrite), and DELETE (delete) More recently added: PATCH (partial update in place) Send state along with operations Very widely used today (Amazon, Flickr, Twitter) 21 Client-server interaction: summary Server handles requests from client Simple request/response protocols (like HTTP) useful, but lack language integration RPC schemes (SunRPC, DCE RPC) address this OOM schemes (CORBA, DCOM, RMI) extend RPC to understand objects, types, interfaces, exns, Recent WWW developments move away from traditional RPC/RMI: Avoid explicit IDLs since can slow evolution Enable asynchrony, or return to request/response 22 11

Clocks and distributed time Distributed systems need to be able to: order events produced by concurrent processes; synchronize senders and receivers of messages; serialize concurrent accesses to shared objects; and generally coordinate joint activity This can be provided by some sort of clock : physical clocks keep time of day (must be kept consistent across multiple nodes why?) logical clocks keep track of event ordering Relativity can t be ignored: think satellites 23 Physical clock technology Quartz Crystal Clocks (1929) resonator shaped like a tuning fork laser-trimmed to vibrate at 32,768 Hz standard resonators accurate to 6ppm at 31 C... so will gain/lose around 0.5 seconds per day stability better than accuracy (about 2s/month) best resonators get accuracy of ~1s in 10 years Atomic clocks (1948) count transitions of the cesium 133 atom 9,192,631,770 periods defined to be 1 second accuracy is better than 1 second in 6 million years... 24 12

Coordinated Universal Time (UTC) Physical clocks provide ticks but we want to know the actual time of day determined by astronomical phenomena Several variants of universal time UT0: mean solar time on Greenwich meridian UT1: UT0 corrected for polar motion; measured via observations of quasars, laser ranging, & satellites UT2: UT1 corrected for seasonal variations UTC: civil time, tracked using atomic clocks, but kept within 0.9s of UT1 by occasional leap seconds 25 Computer clocks Typically have a Real-Time Clock (RTC) CMOS clock driven by a quartz oscillator battery-backed so continues when power is off Also have range of other clocks (PIT, ACPI, HPET, TSC,...), mostly higher frequency free running clocks driven by quartz oscillator mapped to real time by OS at boot time programmable to generate interrupts after some number of ticks (~= some amount of real time) 26 13

Operating-system use of clocks OSes use time for many things Periodic events e.g., time sharing, statistics, at, cron Local I/O functions e.g., peripheral timeouts; entropy Network protocols e.g., TCP DELACK, retries, keep-alive Cryptographic certificate/ticket generation, expiration Performance profiling and sampling features Ticks trigger interrupts Historically, timers at fixed intervals (e.g., 100Hz) Now, tickless : timer reprogrammed for next event Saves energy, CPU resources especially as cores scale up Which of these require physical time vs logical time? What will happen to each if the real-time clock drifts or steps due to synchronization? 27 Summary + next time (!) Object-Oriented Middleware (OOM) CORBA, DCOM, RMI, XML-RPC, SOAP, REST Clocks and distributed time Physical clock technology, UTC What clocks in computers are for More on physical time Time synchronization Ordering The happens-before relation Logical and vector clocks 28 14