Software Engineering and Architecture

Slides:



Advertisements
Similar presentations
Executional Architecture
Advertisements

Remote Object Invocation Tran, Van Hoai Department of Systems & Networking Faculty of Computer Science & Engineering HCMC University of Technology.
Notes to the presenter. I would like to thank Jim Waldo, Jon Bostrom, and Dennis Govoni. They helped me put this presentation together for the field.
EEC-681/781 Distributed Computing Systems Lecture 3 Wenbing Zhao Department of Electrical and Computer Engineering Cleveland State University
Systems Architecture, Fourth Edition1 Internet and Distributed Application Services Chapter 13.
7-Aug-15 Serialization and XML Pat Palmer What is serialization? “The process of converting an object (or a graph of objects) into a linear sequence.
XP New Perspectives on Browser and Basics Tutorial 1 1 Browser and Basics Tutorial 1.
CSCI 6962: Server-side Design and Programming Web Services.
CS 390- Unix Programming Environment CS 390 Unix Programming Environment Topics to be covered: Distributed Computing Fundamentals.
Spring/2002 Distributed Software Engineering C:\unocourses\4350\slides\DefiningThreads 1 RMI.
RMI remote method invocation. Traditional network programming The client program sends data to the server in some intermediary format and the server has.
RMI Remote Method Invocation Distributed Object-based System and RPC Together 2-Jun-16.
S O A P ‘the protocol formerly known as Simple Object Access Protocol’ Team Pluto Bonnie, Brandon, George, Hojun.
Software Architecture Quality Attributes. Good or Bad? Measurable criterions required...
A service Oriented Architecture & Web Service Technology.
Ur/Web: A Simple Model for Programming the Web
Cloud Computing and Architecuture
Software Architecture in Practice
Java Distributed Object System
Cleveland SQL Saturday Catch-All or Sometimes Queries
Scalability: Load Balancing
Special Topics in CCIT: Databases
Prof. Leonardo Mostarda University of Camerino
WEB SERVICES.
Software Architecture in Practice
CORBA Alegria Baquero.
Distribution and components
CHAPTER 3 Architectures for Distributed Systems
Whether you decide to use hidden frames or XMLHttp, there are several things you'll need to consider when building an Ajax application. Expanding the role.
Remote Method Invocation
Software Architecture in Practice
Knowledge Byte In this section, you will learn about:
Objects First with Java A Practical Introduction using BlueJ
Inventory of Distributed Computing Concepts and Web services
CSE 451: Operating Systems Winter 2006 Module 20 Remote Procedure Call (RPC) Ed Lazowska Allen Center
DISTRIBUTED COMPUTING
CORBA Alegria Baquero.
Lecture 4: RPC Remote Procedure Call Coulouris et al: Chapter 5
CSE 451: Operating Systems Autumn 2003 Lecture 16 RPC
CSE 451: Operating Systems Winter 2007 Module 20 Remote Procedure Call (RPC) Ed Lazowska Allen Center
Architectures of distributed systems Fundamental Models
Lecture 4: RPC Remote Procedure Call CDK: Chapter 5
Architectures of distributed systems Fundamental Models
CSE 451: Operating Systems Winter 2004 Module 19 Remote Procedure Call (RPC) Ed Lazowska Allen Center
Distributed Systems through Web Services
CSE 451: Operating Systems Spring 2012 Module 22 Remote Procedure Call (RPC) Ed Lazowska Allen Center
Objects First with Java A Practical Introduction using BlueJ
CSE 451: Operating Systems Autumn 2009 Module 21 Remote Procedure Call (RPC) Ed Lazowska Allen Center
Distribution Infrastructures
Deepak Shenoy Agni Software
Planning and Storyboarding a Web Site
Developing and testing enterprise Java applications
Architectures of distributed systems
WEB SERVICES From Chapter 19, Distributed Systems
Objects First with Java A Practical Introduction using BlueJ
Architectures of distributed systems Fundamental Models
CSE 451: Operating Systems Autumn 2010 Module 21 Remote Procedure Call (RPC) Ed Lazowska Allen Center
CSE 451: Operating Systems Winter 2003 Lecture 16 RPC
Software Engineering and Architecture
Software Engineering and Architecture
Software Engineering and Architecture
Software Engineering and Architecture
Software Engineering and Architecture
Software Engineering and Architecture
CSE 451: Operating Systems Messaging and Remote Procedure Call (RPC)
Software Engineering and Architecture
Java Chapter 5 (Estifanos Tilahun Mihret--Tech with Estif)
Software Engineering and Architecture
Software Engineering and Architecture
SDMX IT Tools SDMX Registry
Presentation transcript:

Software Engineering and Architecture Distributed Systems An Introduction

Henrik Bærbak Christensen Distributed System Why? To speed up computation Google search, and a few other cases To share information Everything else! (Slight exaggeration!) CS@AU Henrik Bærbak Christensen

… vast subject area !!! Limitations Distributed systems and distributed computing is a… We will limit ourselves to a ”niche” … vast subject area !!! Client-server Architectures using Remote Procedure Call … this niche covers a lot of systems in practice  CS@AU Henrik Bærbak Christensen

And Limiting ourselves Even that is … because it must be Highly available, performant, and secure And that is topics in advanced software architecture … difficult to make!!! We will only consider happy path: All computers and networks are working Few users and none that are malicious What is happy path: Well – when all systems are actually working, there is no load, and there are no attack on it. CS@AU Henrik Bærbak Christensen

Henrik Bærbak Christensen One Word of Caution We will happily disregard security !!! Security is so important that we ignore it! Because the real security techniques is one big set of hard bindings and strong coupling You need certificates that tie you to a specific DNS name Certificate stores, key pair generation, trust chains, yaga yaga Quite a lot of extra coding Morale: Add that stuff for real production usage ! CS@AU Henrik Bærbak Christensen

Henrik Bærbak Christensen The History Birrell and Nelson, 1984: “allow calling procedure on remote machines” A calls procedure f on B means A suspends, information on f is transmitted to B B executes the f procedure B sends the result back to A A resumes CS@AU Henrik Bærbak Christensen

Grounding Example TeleMed

Henrik Bærbak Christensen Case Demographic challenges 2009: 70% of public health expenditure goes to chronic diseases 2040: 100% more elderly Geographical challenges Larger, fewer hospitals Fewer general practitioners Leads to a need for telemedical solutions ICT-supported healthcare services where some of the people participating in service delivery are not co-located with the receiver of the service (Our research: www.net4care.org) CS@AU Henrik Bærbak Christensen

Henrik Bærbak Christensen Vision Vision Replace out-patient visits by measurements made by patients in their home Move data from home to regional/national storage so all health care personal can view them... Motivation Reduce out-patient visits Better quality of life Cost savings Better traceability and visibility CS@AU Henrik Bærbak Christensen

Henrik Bærbak Christensen Story 1 2) BP measurement stored as HL7 document 1) Inger measures her BP using her TeleMed terminal CS@AU Henrik Bærbak Christensen

Henrik Bærbak Christensen Story 2 2) Query for all BP documents associated with Inger 1) GP queries last month’s BP measurements for Inger using web browser CS@AU Henrik Bærbak Christensen

(What is XDS) Cross-Enterprise Document Sharing Think One Registry + Multiple Repositories Repository: Stores clinical documents (id,document) pairs Registry: Stores metadata with document id Metadata (cpr, timeinterval, physician, measurement type,...) Id of associate document and its repository Think Registry = Google (index but no data) Repository = Webserver (data but no index) H B Christensen

(What is HL7) HL7 is a standard (complex!) for clinical information storage and exchange. Version 3 loves XML! Our version: Real version: H B Christensen

Henrik Bærbak Christensen TeleMed Design Roles involved TeleObservation: Represents a measurement HomeClient: Responsible for measuring + uploading TeleMed: Responsible for storage and queries CS@AU Henrik Bærbak Christensen

Demo Start a server Send an obs. GP review in browser gradle serverHttp Send an obs. gradle homeHttp … -Psys=126 -Pdia=70 -Pid=pid01 GP review in browser http://localhost:4567/bp/pid01 Story 1 Story 2

Henrik Bærbak Christensen Source Code The source code is open source at https://bitbucket.org/henrikbaerbak/broker/ Download or Fork CS@AU Henrik Bærbak Christensen

Henrik Bærbak Christensen Source Code Subprojects Broker: Core roles + default implementation of some Demo: The TeleMed code including tests of broker code Others: We will return to these later… CS@AU Henrik Bærbak Christensen

Issues in Distribution Why is it hard?

Henrik Bærbak Christensen Challenge How guys like me like to code: Which is then something like: CS@AU Henrik Bærbak Christensen

Henrik Bærbak Christensen Challenge However - networks only support two asynch functions! Which is not exactly the same as CS@AU Henrik Bærbak Christensen

Issues (at least!) Send/receive is a too low level programming model Send() does not wait for a reply from server (Asynch) Reference to object on my machine does not make sense on remote computer (memory address) Networks does not transfer objects, just bits Networks are slow Networks and Remote computers may fail Networks are insecure, others may pick up our data Security QA Availability QA Performance QA Architectural Issues: Not SWEA stuff CS@AU Henrik Bærbak Christensen

Henrik Bærbak Christensen Performance Just how much slower is a network call compared to a local in-JVM memory call? Imagine that your next trip to the supermarket for a beer was 275 times slower??? 10 minutes walk versus 46,8 hours walking  CS@AU Henrik Bærbak Christensen

Henrik Bærbak Christensen Elements of a Solution On the ‘happy path’, we need to Make the HomeClient invoke a synchronous method call on a remote TeleMed object using only network send/receive Keep our OO programming model: telemed.processAndStore(to); That is invoke specific method on remote object Convert TeleObservation object into bits to send it, and convert it back again Locate the remote TeleMed object CS@AU Henrik Bærbak Christensen

Henrik Bærbak Christensen Elements Overview Solutions are Request/Reply Protocol Simulate synchronous call (solves (partly) concurrency issue) Marshalling Packing objects into bits and back (solves data issue) Proxy Pattern (and Broker pattern) Simulate method call on client (solves programming model issue) Naming Systems Use a registry/name service (solves remote location issue) CS@AU Henrik Bærbak Christensen

Request/Reply

Henrik Bærbak Christensen The Protocol Known from every WWW access you have ever made… CS@AU Henrik Bærbak Christensen

Pairing Send/Receives Client does Send() and receive Server does Receive() and send() Roles Client is active – initiate action Server is reactive – awaits actions and then reacts CS@AU Henrik Bærbak Christensen

Henrik Bærbak Christensen Marshalling Or Serialization CS@AU Henrik Bærbak Christensen

Henrik Bærbak Christensen Definitions CS@AU Henrik Bærbak Christensen

Henrik Bærbak Christensen Two Basic Approaches There are two approaches Binary formats Google ProtoBuf, propriatary Textual formats XML, JSON, propriatary Exercise: Costs? Benefits? JSON blood pressure CS@AU Henrik Bærbak Christensen

Henrik Bærbak Christensen And we need more As we can send only bits, we also need to marshal information about the method and object id! CS@AU Henrik Bærbak Christensen

Henrik Bærbak Christensen Note Marshalling is fine for atomic datatypes (int, String, double, array, …) but… What about object references? inventory.addCustomer(c) where c is Customer object? Java RMI can do such things, but it is complex Naming schemes, registries of implementing classes, dynamic class loading, … CS@AU Henrik Bærbak Christensen

Henrik Bærbak Christensen The Details Pass by reference The Java style for all objects You do not get the ”Hello” string, you get a reference to it! public void say(String s); Pass by value Java does this for primitive types, like int and double You do get the value itself public void deposit(double amount); CS@AU Henrik Bærbak Christensen

Henrik Bærbak Christensen In C and C++ In C and C++ you can actually do both If the first call adds 10 to value, what happens to value at the call site? int v = 7; fooByValue(v); print(v); If the second call adds 10 to value, what happens to value at the call site? int v = 7; fooByRef(&v); print(v); CS@AU Henrik Bærbak Christensen

In Our Broker The semantics change in our Broker Pattern localObject.say(”Hello”) localObject pass by reference remoteObject.say(”Hello”) remoteObject pass by value Exercise: Why? Our Broker only supports pass by value! If we pass references, then our server may begin to call methods on the object on our client! Not client-server! And scales terribly! CS@AU Henrik Bærbak Christensen

JSON Libraries

Henrik Bærbak Christensen Libraries Every distributed system in the world needs to marshall! Thus – lots of marshalling libraries around  Do NOT do it yourself!!! String json = ”{ name: ”+ object.name+ ”}… JSON I have used many libraries Json-simple Jackson JSON Gson CS@AU Henrik Bærbak Christensen

Henrik Bærbak Christensen Gson Gson is the most compact I have used (But have had trouble with ‘date’ objects that marshall incorrectly!) It allows easy marshalling of record types Also known as PODO: Plain Old Data Objects, DTO: Data Transfer Object Record type (Pascal) / ‘struct’ (C) / ”bean” (java) No complex methods, only set/get methods with no side effects Must have a default constructor That is: A pure data object, just storing information Akin a ‘resource’ in REST terminology, by the way CS@AU Henrik Bærbak Christensen

Henrik Bærbak Christensen Example: toJson(obj) Marshall fromJson(str, type.class) Demarshall, using given type CS@AU Henrik Bærbak Christensen

Proxy

Henrik Bærbak Christensen Example TeleMedProxy Client Server Network call CS@AU Henrik Bærbak Christensen

Henrik Bærbak Christensen Note The algorithm of all methods in the proxy will be the same Marshall parameters, send, await reply, demarshall, return Can be auto generated – this is what RMI does We will hand-code it, because … it is the learning goal of this course  And it actually makes sense if you want very strict control of architectural attributes like performance and availability And, if you do not, you are in big trouble  CS@AU Henrik Bærbak Christensen

Henrik Bærbak Christensen Why QAs Why? One Example: You have a lot of accessor methods, and a single mutator i.e. state only changes when mutator is invoked! RMI will autogenerate proxy (send/receive) for every method That is, every accessor method call will generate network traffic! Performance Antipattern: Chatty interface Pattern: Chunky interface All accessors just return cached state in the proxy instance itself! CS@AU Henrik Bærbak Christensen

Name Services

Henrik Bærbak Christensen Name Services If I do not know, I know someone who does… If I do not know the telephone number of X, I know someone who does Old days: Telephone book More modern days: krak.dk, linked in, facebook, whatever DNS: Domain Name Servers CS@AU Henrik Bærbak Christensen

Henrik Bærbak Christensen Name Services Name Services are actually just a fancy name for a Map<Key, Value> data structure which allows me to associate a name/key with an object DNS: I have ‘www.imhotep.dk’ as key, please give me the IP address of the associated computer RMI Registry: I have this name ‘/sensor/temperature/47’, please give me a remote reference so I can talk with the remote object These are server based solutions You contact a server that keeps the (key,value) database CS@AU Henrik Bærbak Christensen

Henrik Bærbak Christensen Local Name Services For a single server system, you do not need an external name service, you can keep the (key,value) in the (memory of) the server TeleMed does this It uses the CPR / patient id as the key to lookup measurements Next week we will augment it a bit... CS@AU Henrik Bærbak Christensen

Henrik Bærbak Christensen Summary The Broker Pattern combines Request/Reply protocol Marshalling Proxy pattern Naming Systems … to produce something that (on happy days) Allows an Object Oriented Programming model to apply to distributed computing CS@AU Henrik Bærbak Christensen