Key elemets of the Web Αρχιτεκτονική Πελάτη/Εξυπηρετητή (Cliet/server): οι «πελάτες» αλληλεπιδρούν με τους «εξυπηρετητές» (web servers) The Web as a Computig System Ενιαίο Σύστημα Διευθυνσιοδότησης Πόρων (Addressig system - Uiform Resource Locators) http://domai/directory/file.html Πρωτόκολλο αλληλεπίδρασης, διαστρωμάτωσης εφαρμογών (applicatio-level etwork protocol) HTTP, Hypertext Trasfer Protocol, is the laguage uderstood by browsers ad web servers desiged to move quickly from documet to documet Γλώσσες Σήμανσης (Markup Laguage) every web server uderstads ad every browser displays icludes support for HyperText ad multimedia 2 Cetralized vs Distributed computig Ποιά είναι η αρχιτεκτονική συστήματος του Ιστού; Πώς λειτουργεί το μοντέλο πελάτη-εξυπηρετητή; Πελάτες-Εξυπηρετητές Ιστού Διαστρωματώσεις Παρουσίασης, Επιχειρησιακής Λογικής, Αποθήκευσης Με ποιό πρωτόκολλο αλληλεπιδρούν οι πελάτες και οι εξυπηρετητές του Ιστού; Cetralized computig Low cost: time-sharig, amortizig buildig cost Expert maagemet Distributed approach: Richer user iterface: higher badwidth available locally Greater autoomy Ανατομία μιας αλληλεπίδρασης Ιστού 4
Louise ad Christie make a cake Cake -- result of the service Distributed Computig Models explaied Recipe -- kow-how / code Igrediets -- resource compoet / data Louise -- computatioal compoet A Christie -- computatioal compoet B Louise s home -- Site A Christie s home -- Site B A. Carzaiga, G.P. Picco ad G. Viga, Desigig Distributed Applicatios with Mobile Code Paradigms. Proceedigs of the 19th Iteratioal Coferece i Software Egieerig, 1997 6 Traditioal Cliet ad Server Model Remote Evaluatio Model: (REV) Site B: Christie Site A: Louise Site B: Christie Site A: Louise Request of cake Wats to Eat cake Recipe Wats to Eat cake Cliet Read the recipe Bake the cake Deliver the cake X Widows System Server Get the recipe Bake the cake Deliver the cake Uix: rsh commad PostScript priter A. Carzaiga, G.P. Picco ad G. Viga, Desigig Distributed Applicatios with Mobile Code Paradigms. Proceedigs of the 19th Iteratioal Coferece i Software Egieerig, 1997 7 8
Code o Demad (COD) Mobile Aget Model: (MA) Site A: Louise Site B: Christie Site A: Louise Site B: Christie Wats to Eat cake Request for Recipe Louise Has: Louise moves to Site B alog with recipe ad igrediets Has: Recipe Igrediets Recipe Lack: Igrediets Lack: Do t care Cake Termial gets a ew type of documet. Documet header may cotai a referece (URL address) to the code that is eeded to iterpret the documet. The the priciple will go to the referece ad dowload the ecessary code ad execute it afterwards. 9 10 Paradigm Recap Before After Choosig the Right Paradigm No paradigm is absolutely better tha others. The choice of paradigm must be performed o a case-bycase basis, takig ito accout issues such as the cost of etwork commuicatio, availability ad performace of resources, etc. A ad B is already i executio 11 12
Cliet-server Computig Cliet Server Architecture Cliet LAN/ WAN Server 13 14 Cliet-server Browser Cliet Server Not widely popular for the masses The browser gradually became a platform 15 16
Browsers as platforms True cliet-server computig with browsers Cliet 17 Web & Cliet/Server Architecture 18 What happes behid the scee? Cliet-Server Architecture Web Cliet (Browser) Server Cliet HTML Server PHP Site Iteret XML HTTP Javascript 3-tier Architecture Web server Presetatio Tier Appl. server Logic Tier SQL DB Persistece Tier Data Ceter 19 20
Web Servers ad Cliets Web server: software that listes for web page requests: Apache,Microsoft Iteret Iformatio Server (IIS), NGINX Applicatio server: Software framework that provides a eviromet where applicatios ca ru: Apache, Glassfish, WebSphere, WebLogic Web browser [Πλοηγός / Φυλλομετρητής Ιστού]: fetches/displays documets from web servers: Mozilla Firefox, Microsoft Iteret Explorer (IE), Apple Safari, Google Chrome, Opera 21 Elemets of Web architecture ad iteractios Web server Itraet Data Source Iteret Web server Data Source Proxy PC Browser Web server Data Source Web server Data Source 24
Software Elemets of the Web Cliet programs: Iitiate coectios to submit requests. Typical systems are: Φυλλομετρητές-πλοηγοί (browsers). Αράχνες-ιχνηλάτες (spiders, crawlers, harvesters). Διεκπεραιωτές (agets). Server programs [Εξυπηρετητής / διακομιστής / διαθέτης]: Accepts coectios to serve icomig requests. Should be able to decode icomig requests ad execute them. Proxies, itermediaries (Ενδιάµεσοι). Gateways (Πύλες). Tuels (Σήραγγες). Which tier is ecessary for the operatio of a Web site? Applicatio Tier Presetatio Tier Persistece Tier Presetatio ad Applicatio Tiers 25 EΠΛ425 Web cliets Ιστού Software Elemets of the WWW Cliet Systems (user agets) Basic Web architecture comprises: A cliet submittig a request to a server. A server receivig, readig the request, executig some istructios ad sedig back a reply to the cliet. The cliet reads the reply, iterprets it ad presets the aswer to the user. I typical cliet-server systems, the cliet programs are relatively simple ad the server programs are complicated. I the case of the Web, the cliet systems are typically quite complicated (why?) 28
Evolutio of Web browsers Basic fuctioality of a Web browser Αρχικά επρόκειτο για απλούς πλοηγούς, οι οποίοι υποβοηθούσαν τους χρήστες να πλοηγηθούν στο Διαδίκτυο. Σταδιακά μετατράπηκαν σε ενιαίο σημείο εισόδου και μοναδική διαπροσωπεία προς την πλειονότητα των λειτουργικοτήτων που προσφέρει ένας Η/Υ σε ένα χρήστη: Πλοήγηση σε τοπικό σύστημα αρχείων. Πρόσβαση σε ηλεκτρονικό ταχυδρομείο και ηλεκτρονικούς πίνακες ανακοινώσεων. Μεταφορά αρχείων. WWW Provide the user with: A sese of cotext of his avigatio (συγκείμενο πλοήγησης) where is the user ad which iformatio is accessible from the page he is o. A view of where he ca avigate to ad where he was before. The capability to adapt his avigatio ad the presetatio of cotet he retrieves. The capability for searchig iside a collectio of iformatio. 29 30 Browser fuctioality Raisig HTTP requests from browsers Browser DNS Server Origi Server Origi Server URL 1. DNS query UI elemet Forward/Backward butto Hyperlik selectio Request costructed from: History mechaism of browser Correspodig URL embedded i ΗΤΜL file 2. TCP Coectio Bookmarks Bookmark file 3. HTTP Request 4. HTTP Respose Click or Hit Retur i Submit/ Press butto Browser address field Correspodig URL i butto or form URL typed o address field 5. Optioal parallel coectios Various meus Selected field of meu Βrowser sessio (σύνοδος πλοηγού): a sequece of requests issued by a user - possibly related to the replies received to previous requests. Reload butto Images Curret URL Automatically from the image URLs embedded i a dowloaded HTML file 31 32
Web cachig (Eναποθήκευση πλοηγού) Browser cofiguratio Cache (Κρύπτη ή Λανθάνουσα Μνήμη ή Κρυφή μνήμη): a local space for storig messages that ca be used to: reduce respose time to cliet requests reduce Iteret traffic reduce server load Two types of browser cachig: Mai memory Local Disk Two types of cofiguratios: Exteral characteristics - about fots, color, formatig of cotet, presetatio of images. Iteral sematic characteristics, like the choice of preferred laguage, the decisio to cache or ot, the use of a proxy server, the hadlig of replies, the hadlig of cookies etc. Cachig fuctioalities: Cache revalidatio (Έλεγχος εγκυρότητας) cotrollig the freshess cached data. Cosistecy (συνέπεια κρύπτης): strog (ισχυρή) και weak (ασθενής). For cache revalidatio we eed to keep i the cache the time of last update of the cached cotet. The relevat timestamp is ofte (but ot always) give correctly by the origi server. 33 34 Proxies (ενδιάμεσοι - διαμεσολαβητές) Itermediary Systems (proxies) Συστήµατα Διαµεσολάβησης Itroducig a proxy (itermediary) i the commuicatio betwee cliet ad server ca offer a umber of advatages, such as: Reductio i the traffic received by the origi server - through cachig Reducig the latecy of servig the cliet (why?) Reducig the load received by the server (why?) Defiitio (HTTP/1.0 draft): Proxy (διαμεσολαβητής) is a itermediary program (ενδιάμεσο) that operates both as cliet ad as server, with the aim to forward requests ad replies. Proxies ofte operate as gateways to firewalls. Proxies accept requests from cliets ad serve them either locally or by possibly traslatig them ad forwardig them to other servers. Requests must be set to the proxy ad ot to the origi server. 36
Proxies Άλλες κατηγορίες Ενδιάμεσων (Itermediaries) Gateway (Πύλη): A program operatig as itermediary with servers ruig protocols other tha HTTP. Whe forwardig a HTTP request, the gateway traslates the request to a ew protocol ad vice versa. The cliet seds his request to the gateway, without kowig the existece of the origi server, its address ad its operatio - hece, for the cliet, the gateway appears to be the origi server. Tuel (Σήραγγα): Itermediary that operates as blid: router of buts betwee two coectios. It does ot parse or iterpret the cotet of messages. Tuels do ot perform cachig. 37 38 Proxies ad Tuels Proxy Server Classificatio Cliet 1. Request to Proxy 4. Respod to Cliet 2. Request to Server Proxy 3. Respose to Proxy Origi Server Accordig to two dimesios: Cachig - Eναποθήκευση Trasparecy - Διαφάνεια: Διαφανείς ενδιάμεσοι (trasparet proxies): δεν επεμβαίνουν στα αιτήματα ή τις απαντήσεις, παρά μόνο κατά τρόπο επουσιώδη. Cliet 1. Request to Server 4. Respose to Cliet 2. Request to Server Tuel Origi Server 3. Respose to Cliet Αδιαφανείς ενδιάμεσοι (o-trasparet proxies): μπορούν να επεμβαίνουν στα αιτήματα και τις απαντήσεις. Π.χ. Διαμεσολαβητές ανωνυμίας aoymizer proxies Διαμεσολαβητές φιλτραρίσματος filterig proxies Διαμεσολαβητές μετατροπείς trascodig proxies 39 40
Άλλα είδη Διαμεσολαβητών HTTP Proxy Server operatio Reverse proxies ανάστροφοι διαμεσολαβητές: placed i frot of the origi servers. Operate as origi servers for the cliets Reduce server load. Hide origi server IP from cliet systems ad outside etworks (security) Load balacig betwee multiple origi servers. Iterceptio proxies διαμεσολαβητές παρεμβολής Itercept ormal commuicatio at the etwork layer without requirig ay special cliet cofiguratio. Cliets eed ot be aware of the existece of the proxy. A trasparet proxy is ormally located betwee the cliet ad the Iteret, with the proxy performig some of the fuctios of a gateway or router URL Browser 1. DNS query DNS Server 2. TCP Coectio 3. HTTP Request 4. HTTP Respose 4. DNS query Proxy 5. TCP Coectio 6. HTTP Request 6. HTTP Respose Origi Server 41 42 Web site Origi Servers ή Web servers Εξυπηρετητές ΠΠΠ ή Πηγαίοι Εξυπηρετητές Συλλογή ιστοσελίδων, οι οποίες αντιστοιχούν σε κάποιο κοινό όνομα κόμβου (Hostame). Είδη ιστιακών τόπων: πανεπιστήμια, busiess-to-cosumer, corporate itraet, busiess-to-busiess, special evet, portal, search, gateway to other services. Portal: ιστιακός τόπος που προσπαθεί να δημιουργήσει και να διατηρήσει μακροχρόνιες σχέσεις με μεγάλο αριθμό χρηστών προσφέροντας ένα κεντρικό τόπο για ανεύρεση πληροφοριών. 44
Web Servers (Εξυπηρετητές Ιστού) Προγράμματα που χειρίζονται αιτήματα HTTP για συγκεκριμένους πόρους. Ο εξυπηρετητής «τρέχει» πάνω σε ένα υπολογιστικό σύστημα το οποίο διαθέτει διασύνδεση με το διαδίκτυο. Το υ/σ αποτελείται από: Έναν ή περισσότερους επεξεργαστές. Κεντρική μνήμη. Σκληρούς δίσκους για αποθήκευση περιεχομένου και κώδικα. Ο εξυπηρετητής αλληλεπιδρά με τους επεξεργαστές, την μνήμη, το δίσκο και το δίκτυο μέσω του λειτουργικού συστήματος. 45 Web server fuctioality Web server fuctioality Receive cliet requests Iterpret requests ad security cotrol Collect cotet requested ad put ito reply message Dispatch reply message to cliet A process ruig i backgroud mode (daemo), listeig for icomig requests Listes to specified TCP port - default is TCP socket coectios at port 80 of the computer upo which it is ruig Additioal fuctioalities Executio of programs to create dyamic iformatio. Actig as gateway to databases ad other resources. The Web server is ot ivolved i how the iformatio dispatched is preseted at the user aget. Cliet iitiates TCP coectio ad submits request through the socket. Web server commuicates through the socket ad does ot eed to kow how packets are set or received by TCP. 47 48
Servig cliet requests 1. Readig ad scaig HTTP requests. 2. Traslatig the requested URL i a file ame or program to be ivoked. 3. Authorisatio cotrol. 4. Productio ad dispatch of reply. Observatios: The process of servig HTTP requests is typically registered i a log file (αρχείο απογραφής). Τhe HTTP reply sometimes may ot carry cotet but oly cotrol iformatio. 50 Web server fuctioality Web server Optimisatio techiques The Web server does ot kow: The existece of liks. For the server, the liks are simply part of a documet where they are embedded. Τhe sematics (σημασιολογία) of Web cotet served to user agets. The existece of embedded images ad other cotet. The existece of liks to files stored at the server. The correctess of MIME declaratios about the formattig of the cotet it serves. The estistece of other servers (except for proxies). Η επίδοση ενός εξυπηρετητή μπορεί να βελτιωθεί με την χρήση πληροφοριών που δημιουργούνται κατά την εξυπηρέτηση ενός αιτήματος, σε επόμενα αιτήματα: Απομνημόνευση στατικού περιεχομένου στην κεντρική μνήμη του εξυπηρετητή (Server-side cachig). Απομνημόνευση δυναμικού περιεχομένου στην κεντρική μνήμη. Κοινοχρησία μεταδεδομένων: Μετάφραση URL σε όνομα αρχείου. Απομνημόνευση πληροφοριών ελέγχου για έναν πόρο. Απομνημόνευση επικεφαλίδων HTTP. Επαναχρησιμοποίηση χρονοσφραγίδας. Επαναχρησιμοποίηση ονόματος πελάτη (cliet hostame). 51 52
Αρχιτεκτονικά Μοντέλα Εξυπηρετητών Διαφορετικά μοντέλα στον σχεδιασμό εξυπηρετητών Ιστού: Which statemet is correct? Εξυπηρετητές συμβάντων (evet-based): Flash, Zeus Εξυπηρετητές διεργασίας (Process-based): Apache, NCSA Εξυπηρετητές νημάτων (Thread-based): JAWS, IIS Εξυπηρετητές πυρήνα (kerel-based): Tux, AFPA, ExoKerel Στη συγκριτική μελέτη των μοντέλων αυτών βαρύνουν χαρακτηριστικά όπως επίδοση, προστασία, κοινοχρηστία, επεκτασιμότητα κλπ. Web cachig results i reducig Web cliet load Web cachig helps i reducig proxy server load Web cachig icreases dyamic traffic o the Web Web cachig has limited impact i improvig the performace of dyamic cotet servig 53 EΠΛ425