d istributed s ystems comp9243 lecture 2 system
play

D ISTRIBUTED S YSTEMS [COMP9243] Lecture 2: System Architecture - PowerPoint PPT Presentation

D ISTRIBUTED S YSTEMS [COMP9243] Lecture 2: System Architecture & Communication B UILDING A D ISTRIBUTED S YSTEM Two questions: Slide 1 Slide 3 Where to place the hardware? Where to place the software? System Architectures


  1. D ISTRIBUTED S YSTEMS [COMP9243] Lecture 2: System Architecture & Communication B UILDING A D ISTRIBUTED S YSTEM Two questions: Slide 1 Slide 3 ➀ Where to place the hardware? ➁ Where to place the software? ➀ System Architectures ➁ Processes & Server Architecture ➂ Communication in a Distributed System ➃ Communication Abstractions System Architecture: ➜ placement of machines ➜ placement of software on machines Where to place?: ➜ processing capacity, load balancing A RCHITECTURE ➜ communication capacity Slide 2 Slide 4 ➜ locality Mapping of services to servers: ➜ Partitioning ➜ Replication ➜ Caching B UILDING A D ISTRIBUTED S YSTEM 1 A RCHITECTURAL P ATTERNS 2

  2. Client-Server from another perspective: Wait for result Client Request Reply A RCHITECTURAL P ATTERNS Slide 5 Slide 7 Server Provide service Time How scalable is this? Example client-server code in C: C LIENT -S ERVER client(void) { struct sockaddr_in cin; Request char buffer[bufsize]; Client Server int sd; Reply Slide 6 Slide 8 sd = socket(AF_INET,SOCK_STREAM,0); connect(sd,(void *)&cin,sizeof(cin)); Kernel Kernel send(sd,buffer,strlen(buffer),0); recv(sd,buffer,bufsize,0); close (sd); } C LIENT -S ERVER 3 C LIENT -S ERVER 4

  3. server(void) { struct sockaddr_in cin, sin; Splitting Functionality: int sd, sd_client; Client machine User interface User interface User interface User interface User interface sd = socket(AF_INET,SOCK_STREAM,0); Application Application Application bind(sd,(struct sockaddr *)&sin,sizeof(sin)); Database listen(sd, queuesize); while (true) { User interface Slide 9 Slide 11 sd_client = accept(sd,(struct sockaddr *)&cin,&addrlen)); Application Application Application recv(sd_client,buffer,sizeof(buffer),0); Database Database Database Database Database DoService(buffer); Server machine send(sd_client,buffer,strlen(buffer),0); (a) (b) (c) (d) (e) close (sd_client); Which is the best approach? } close (sd); } Example client-server code in Erlang: V ERTICAL D ISTRIBUTION (M ULTI - TIER ) % Client code using the increment server client (Server) -> Server ! {self (), 10}, Request Request App. Dbase Client Server Server receive Reply Reply {From, Reply} -> io:format ("Result: ~w~n", [Reply]) Kernel Kernel Kernel end. Slide 10 Slide 12 % Server loop for increment server loop () -> Three ’layers’ of functionality: receive • User interface {From, Msg} -> From ! {self (), Msg + 1}, loop (); • Processing/Application logic stop -> true • Data end. ➜ Logically different components on different machines % Initiate the server start_server() -> spawn (fun () -> loop () end). Leads to Service-Oriented architectures (e.g. microservices). C LIENT -S ERVER 5 V ERTICAL D ISTRIBUTION (M ULTI - TIER ) 6

  4. Vertical Distribution from another perspective: Note: Scaling Up vs Scaling Out? Wait for result User interface (presentation) Horizontal and Vertical Distribution not the same as Horizontal Request and Vertical Scaling . Return operation result Wait for data Application Vertical Scaling: Scaling UP Increasing the resources of a Slide 13 server Slide 15 single machine Request data Return data Horizontal Scaling: Scaling OUT Adding more machines. Database server Time Horizontal and Vertical Distribution are both examples of this. How scalable is this? H ORIZONTAL D ISTRIBUTION P EER TO P EER Front end request Peer handling Replicated Web servers each reply incoming Peer requests containing the same Web pages Kernel Requests Disks handled in Kernel round-robin request reply request fashion reply Peer Slide 14 Slide 16 request Peer reply Kernel Internet Internet Kernel Peer Kernel ➜ Logically equivalent components replicated on different ➜ All processes have client and server roles: servent machines Why is this special? How scalable is this? H ORIZONTAL D ISTRIBUTION 7 P EER TO P EER AND O VERLAY N ETWORKS 8

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend