3. Distributed Systems – Architecture Models Part 2 Object Relationships 2 Broker Pattern: Consequences • Benefits – – – – – Location transparency Changeability and extensibility of components Portability of a Broker system Interoperability between different Broker systems Reusability • Liabilities – Restricted efficiency – Lower fault tolerance (server fails, broker fails, ...) – Testing and debugging 3 SUMMARY of Proxy Design Pattern Problems Context • The configuration of components in distributed systems is often subject to change as requirements evolve • Low-level message passing is fraught with accidental complexity • Remote components should look like local components from an application perspective • i.e., clients & servers should be oblivious to communication issues Solution Apply the Proxy design pattern to provide an OO surrogate through which clients can access remote objects : Client : Proxy : Service service pre-processing: marshaling service post-processing: unmarshaling AbstractService Client service Proxy service 1 1 Service service •A Service implements the object, which is not accessible directly •A Proxy represents the Service and ensures the correct access to it •Proxy offers same interface as Service 6 •Clients use the Proxy to access the Service Client-server Architecture Client-Server Model 7 Multi-Tier Architecture Model Client-Server Model a client, a server, and network Client Server Network Client machine Server machine 9 The Client-Server Model Client Machine Mobile Client Server Desktop Client 10 Client-server • Client/server is a distributed computing model in which client applications request services from server processes. Clients and servers typically run on different computers interconnected by a computer network. – Client application is a process or program that sends messages to a server via the network. Those messages request the server to perform a specific task, such as looking up a customer record in a database or returning a portion of a file on the server’s hard disk. – Server process or program listens for client requests that are transmitted via the network. Servers receive those requests and perform actions such as database queries and reading files. 2-Tier Architecture It is client-server architecture Direct communication Run faster(tight coupled) 2-Tier Architecture 2-Tier Architecture Two parts: 1) Client Application (Client Tier) 2) Database (Data Tier) On client application side the code is written for saving the data in the SQL server database 3-Tier Architecture Web based application Three layers: 1) Client layer 2) Business layer 3) Data layer Client Layer Contains UI part of our application This layer is used for the design purpose where data is presented to the user or input is taken from the user Business layer All business logic written like validation of data, calculations, data insertion etc… This acts as a interface between Client layer and Data Access Layer Make communication faster between client and data layer Data layer Contains methods to connect with database and to perform insert, update, delete, get data from database 3-Tier / Multi-Tier Architecture Model Classical Layered Structure of Software Systems Three-tier Architectures • An important design consideration for large client/server systems is whether a client talks directly to the server, or whether an intermediary process is introduced in-between the client and the server. The former is a two-tier architecture, the latter is a three-tier architecture. • In the three-tier architecture, process between Server and client (intermediary) process is: – separate the clients and servers. – cache frequently accessed server data to ensure better performance and scalability. – Performance can be increased by having the intermediary process to distribute client requests to several servers such that requests execute in parallel. – The intermediary can also act as a translation service by converting requests and replies to and from a mainframe format, or as a security service that grants server-access only to trusted clients. The 3-Tier Architecture Model • The 3-tier architecture consists of the following tiers (layers): – Front-end (client layer) • Client software – provides the UI of the system – Middle tier (business layer) • Server software – provides the core system logic • Implements the business processes / services – Back-end (data layer) • Manages the data of the system (database / cloud) 21 The 3-Tier Architecture Model Data Tier (Back-End) Middle Tier (Business Tier) Client Tier (Front-End) Client Machine Mobile Client Database Business Logic Desktop Client 22 Multitiered Architectures (3 Tier Architecture) Multi-Tier Architecture Model 24 MVC (Model-View-Controller) Model-View-Controller (MVC) • Model-View-Controller (MVC) architecture – Separates the business logic from application data and presentation • Model – Keeps the application state (data) • View – Displays the data to the user (shows UI) • Controller – Handles the interaction with the user 26 Peer-to-Peer System Architecture 27 Based on System Architecture : Peer-to-Peer Model • All the nodes in the network have equal privilege • No special routing server required. The nodes themselves take care of routing the data • Peers – both suppliers and consumers • As the number of nodes increases, the bandwidth increases • Reduces single point failures • It is less secure • Usually used for sharing of resources – files, audio - visual media 28 A Distributed Application Based on Peer Processes 29 Fail-over Fail-over 31 Fail-over 32 Fail-back 33 Replication 35 Master-Slave Replication 36 Master-Slave Replication 37 Tree Replication 38 Master-Master Replication 39 Buddy Replication 40 Buddy Replication 41 Brief Early History of Computing Intergalactic era client/server Ethernet era client/server First Wave Second Wave Database servers File servers 1982 1986 Third Wave Distributed objects 1990 1994 1998 43 Future of Distributed Computing… • An expanded peer-to-peer network with every personal computer interconnected with every other. • Utilization of CPU cycles and hard disks during idle time • Improvements in security and performance that void the need for a centralized control server and a data center 44 45 Crab Computing 46 DESIGN REQUIREMENTS FOR DISTRIBUTED ARCHITECTURES Distributed system (Lamport): a system in which the failure of a computer you didn't even know existed can render your own computer unusable 48 Distributed System Challenges 49 Design Requirements for Distributed Architectures 50 Guidelines for Designing for Performance 51 Some Pitfalls when Developing Distributed Systems 52