Verteilte Systeme (Distributed Systems) Karl M. Göschka Karl.Goeschka@tuwien.ac.at http://www.infosys.tuwien.ac.at/teaching/courses/ VerteilteSysteme/
Lecture organization Lecture schedule (may change!) and content http://www.infosys.tuwien.ac.at/teaching/courses/verteiltesysteme/ Register in TUWIS to receive messages! Exam schedule and registration TUWIS (provide valid email for exam results) Exam questions (catalogue) DS*Lab (LU Verteilte Systeme) (don t contact me) http://www.infosys.tuwien.ac.at/teaching/courses/dslab/ dslab@infosys.tuwien.ac.at Personal questions best to contact me right after the lecture 2
Lecture material Slides available for download, but not sufficient for self-study! Textbook: 2nd edition! be prepared Old 1st edition check for new content! 3
Recommended reading... some pictures in the slides for this course stem from these books 4
Prerequisites Data structures and algorithms (sequential) Operating systems / Systems programming Software engineering concepts Object-oriented programming For the lab: Java s support for modularity (packages and interfaces), object orientation, exceptions, distribution (RMI), code mobility (applets, class loader), and concurrency (threads and synchronization) 5
Lecture 1: Overview and introduction History What is a distributed system? Key concepts and design goals Architectural styles
A revolution took place Until 1985 large and expensive stand-alone computers Powerful microprocessors (price/performance gain 10 12 in 50 years) High-speed computer networks (LAN/WAN) composition of computing systems of large numbers of computers connected by a highspeed network 10
The complete Internet in 1969 11
Part of the Internet in 1980 12
Part of a corporate network today 13
Growth of the Internet Year # Hosts Web servers 1969 4 1971 23 1979 188 1981 213 1988 60,000 1989 130,000 1990 > 300,000 0 1999 > 56 million >5.5 million 2000 > 80 million 2003 >170 million >35 million 2005 >317 million 2007 >433 million >140 million 14
# of Security (CERT 1 ) Incidents Date Incidents Advisories Vulnerabilities ------- --------- ---------- --------------- 1988 6 1 1989 132 7 1990 252 12 1991 406 23 1992 773 21 1993 1,334 19 1994 2,340 15 1995 2,412 18 171 1996 2,573 27 345 1997 2,134 28 311 1998 3,734 13 262 1999 9,859 17 417 2000 21,756 22 774 2001 52,658 37 2,437 2002 82,094 37 4,129 2003 137,529 28 3,784 2006 N/A N/A 8,064 1 Computer Emergency Response Team at the Software Engineering Institute, Carnegie Mellon University 15
Portable and handheld devices Internet Web services, P2P GRID and cloud computing Host intranet Bluetooth Wireless LAN WAP gateway GPRS, UMTS Home intranet Printer Camera Mobile phone Laptop Host site mobile and ad-hoc networks (MANET) pervasive/ubiquitous computing 16
Evolution of distribution technology Mainframe computers Workstations and local networks Client-server systems Internet-scale systems and WWW Sensor/actor networks in automation Mobile, ad-hoc, and adaptive systems Pervasive (ubiquitous) systems Today, less than 2% of processors go into personal computers! 17
Lecture 1: Overview and introduction History What is a distributed system? Key concepts and design goals Architectural styles
Definition of a Distributed System (1) A collection of independent computers that appears to its users as a single coherent system. 19
Definition of a Distributed System (2) A collection of autonomous computers linked by a computer network and supported by software that enables the collection to operate as an integrated facility. 20
Definition of a Distributed System (3) You know you have one when the crash of a computer you have never heard of stops you from getting any work done. (Leslie Lamport) 21
Types of distributed systems Object/component based (CORBA, EJB, COM) File based (NFS) Document based (WWW, Lotus) Coordination (or event-) based (Jini, JavaSpaces, publish/subscribe, P2P) Resource oriented (GRID, Cloud, P2P, MANET) Service oriented (Web services, Cloud, P2P) 22
Types of distributed systems (2) Distributed Computing (cluster, GRID, cloud) Distributed Information System (EAI, TP, SOA) Distributed Pervasive (often P2P, UPnP in home systems, sensor networks,...) 23
Concepts of distributed systems Communication Concurrency and operating system support (competitive, cooperative) Naming and discovery Synchronization and agreement Consistency and replication Fault-tolerance Security 24
Lecture 1: Overview and introduction History What is a distributed system? Key concepts and design goals Architectural styles
Why distribute at all? Connecting users to resources and services Basic function of a distributed system Dependability and Security Availability, FT, Intrusion Tolerance,... Performance Latency, throughput,... Otherwise: Don t distribute, its far more complex hence expensive, error-prone,... 26
Design goals in distributed systems Resource sharing (collaborative, competitive) Transparency Hiding internal structure, complexity Openness Portability, interoperability,... Services provided by standard rules Scalability Ability to expand the system easily Concurrency inherently parallel (not just simulated) Fault Tolerance (FT), availability 27
The 8 Fallacies of Distributed Computing 1. The network is reliable 2. Latency is zero 3. Bandwidth is infinite 4. The network is secure 5. Topology doesn't change 6. There is one administrator 7. Transport cost is zero 8. The network is homogeneous Essentially everyone, when they first build a distributed application, makes the above eight assumptions. All prove to be false in the long run and all cause big trouble and painful learning experiences. (Peter Deutsch) 28
Connecting users and services Access and share (remote) resources Economics and policies Collaboration by information exchange Communication (Convergence, VoIP) Groupware and virtual organizations Electronic and mobile commerce Sensor/actor networks in automation and pervasive computing (fine grained distribution) May compromise security (tamper proof HW) and privacy (tracking, spam) 29
Quality of Service (QoS) QoS is a concept with which clients can indicate the level of service (SLA) they require Examples: For real-time voice communication, the client prefers reliable delivery times over guaranteed delivery In financial applications, a client may prefer encrypted communication in favor of faster communication You can t have it all Trade-offs! 30
Transparency Concept: Hide different aspects of distribution from the client. It is the ultimate goal of many distributed systems. It can be achieved by providing lower-level (system) services (i.e. use another layer). The client uses these services instead of hardcoding the information. The service layer provides a service with a certain Quality of Service. 31
Transparency in a Distributed System Transparency Access Location Migration Relocation Replication Concurrency Failure Persistence Description Hide differences in data representation and how a resource is accessed Hide where a resource is located Hide that a resource may move to another location Hide that a resource may be moved to another location while in use Hide that a resource may exist in several copies Hide that a resource may be shared by several competitive users Hide the failure and recovery of a resource Hide whether a (software) resource is in memory or on disk Transparency: Information Hiding Applied to Distributed Systems 32
Transparency Scaling Transparency Performance Transparency Failure Transparency Mobility Transparency Replication Transparency Concurrency Transparency Access Transparency Location Transparency (ANSA and ISO RM-ODP) 33
Degree of Transparency Not blindly try to hide every aspect of distribution Performance transparency difficult (LAN/WAN) Trade-off transparency/performance Failure masking Replica consistency Transparency is an important goal, but has to be considered together with all other nonfunctional requirements and with respect to particular demands 34
Openness Offer services according to standard rules (syntax and semantics: format, contents, and meaning) Formalized in protocols Interfaces (IDL): semantics often informal Complete Interoperability: Communication between processes Neutral Portability: Different implementations of interface Flexibility: composition, configuration, replacement, extensibility (CBSE) 35
Separating Policy from Mechanism Granularity: objects vs. applications? Component interaction and composition standards (instead of closed/monolithic) E.g. Web browser provides facility to store cached documents, but caching policy can be plugged in arbitrarily (parameters or algorithmic). 36
Achieving openness WWW examples Different Web servers and Web browsers interoperate New browsers may be introduced to work with existing servers (and vice versa) Plugin interface? 37
Scalability A distributed system s ability to grow to meet increasing demands along several dimensions: Size (users and resources) Geographically (topologically) Administratively (independent organizations/domains) System remains effective System and application software should not need to change Trade-Off scalability/security 38
Scalability Challenges (size) Controlling the cost of physical resources: The quantity required should be O(n) Controlling the performance loss: In hierarchical system should be no worse than O(log n) Preventing software resources running out, but over-compensation may be even worse: Internet Addresses or Oracle7 2TB restriction Avoiding performance bottlenecks (centralized services, data, or algorithms) 39
Performance Bottlenecks Concept Example Centralized services A single server for all users Centralized data A single on-line telephone book, central DNS Centralized algorithms Doing routing based on complete information Examples of scalability limitations with respect to size. 40
Decentralized Algorithms No machine has complete system state information Machines make decisions based only on local (surrounding) information Failure of one machine does not ruin the algorithm (no single point of failure) No implicit assumption that a global clock exists 41
Geographical Scalability LAN: Synchronous communication Fast Broadcast Highly reliable WAN: Asynchronous communication Slow(er) and/or more expensive Point to point (e.g. problems with location service) Unreliable 42
Administrative Scalability Conflicting policies: Resource usage Billing Management Security: Protection between the administrative domains trusted domains enforced limitations 43
Scaling Techniques Hiding communication latencies Asynchronous communication (batch processing, parallel applications) Reduce overall communication (HMI) Replication: Availability, load balance, reduce communication Caching: proximity, client decision Consistency issues may adverse scalability! Hierarchical structure Domains, zones, split 44
Scaling Techniques (2) 1.5 An example of dividing the DNS name space into zones. 45
Lecture 1: Overview and introduction History What is a distributed system? Key concepts and design goals Architectural styles
Dealing with complexity Abstraction (and modeling) Client, server, service Interface versus implementation Information hiding (encapsulation) Interface design Separation of concerns Layering (filesystem example: bytes, disc blocks, files) Client and server Components (granularity issues) 48
Communication models Multiprocessors: shared memory Multicomputers: message passing Synchronization in shared memory: Semaphores (atomic mutex variable) Monitors an abstract data type whose operations may be invoked by concurrent threads; different invocations are synchronized Synchronization in multicomputers: blocking in message passing 49
Architectural Styles Important styles of architecture for distributed systems Layered architectures (OSI) Object-based architectures (and components) Data-centered architectures (file based, database, resourceful WS,...) Event-based architectures... and combinations thereof 50
The layered architectural style 51
The object-based architectural style 52
The event-based architectural style 53
The shared space architectural style 54
System Architectures: Centralized 55
Conceptual Layers Presentation ( client) interact with external entities human (GUI) or system (data format) Application Logic data processing, actual operation, services also called: business [processes logic rules] Resource Management database, file system, legacy system other data source (using other Information Systems as components) also called: data layer 56
Conceptual Layers (2) client presentation layer application logic layer resource management layer information system Copyright Springer Verlag Berlin Heidelberg 2004 57
One tier architecture 1-tier architecture client presentation layer application logic layer resource management layer information system Copyright Springer Verlag Berlin Heidelberg 2004 58
Two tier architecture 2-tier architecture client presentation layer application logic layer resource management layer server information system Copyright Springer Verlag Berlin Heidelberg 2004 61
Vertical Distribution 63
Three tier architecture 3-tier architecture client presentation layer application logic layer resource management layer middleware information system Copyright Springer Verlag Berlin Heidelberg 2004 65
Application (System) Integration client presentation layer integration logic client client application logic layer middleware wrappe r wrappe r wrappe r resource management layer 1-tier 2-tier 3-tier Copyright Springer Verlag Berlin Heidelberg 2004 67
N-tier architecture client Web browser Web server HTML filter application logic layer presentation layer middleware information system Copyright Springer Verlag Berlin Heidelberg 2004 resource management layer 68
N-Tier and Web Client Java Applet Web Browser HTML Client Devices Presentation Tier Specific servers Windows Application Distribution Protocol: IIOP, RMI, or proprietary (e.g. DCE) Java Application Web Server Glue Logic HTTP HTTP Daemon Servlet static content and templates: HTML XHTML XML JSP Business Tier Session Session Session Session Business Logic Distributed Component Based Infrastructure Transaction Manager Content Mgmt Persistence Manager Libraries Wrapper/Connector Resource Tier Database Access Protocol: JDBC, SQLJ, or proprietary (e.g. SQL*Net) Legacy System proprietary legacy protocol Database Server proprietary legacy protocol 70
Horizontal Distribution 1-31 An example of horizontal distribution of a Web service. 71
Horizontal Distribution (2) Communication demand and proximity Physical restrictions Resources may be bound to nodes Granularity Flexibility vs. network traffic Choice of protocols Interoperability and load End to end properties CAP Consistency, Availability, Performance Full distribution distributed architecture 72
Distributed Architectures: P2P The mapping of data items onto nodes in Chord. 73
Summary A distributed system is a collection of computers working seamlessly together (single-system image pro/con!) Distributed systems have evolved to be pervasive Principles and techniques are needed to cope with the complexity of distributed systems (openness, scalability, architectural styles,...) Basic abstractions and concepts for distributed systems: client/server, layering (multitier), middleware, service, QoS,... 74