cs4513 dist ribut ed comput er syst ems
play

CS4513 Dist ribut ed Comput er Syst ems The Web Huge client-ser - PDF document

The Wor ld Wide Web CS4513 Dist ribut ed Comput er Syst ems The Web Huge client-ser ver syst em (Ch 11.1) Document-based Ref erenced by Unif orm Resource Locat or (URL) Document Model Out line All inf or mat ion in


  1. The Wor ld Wide Web CS4513 Dist ribut ed Comput er Syst ems The Web • Huge client-ser ver syst em (Ch 11.1) • Document-based – Ref erenced by “Unif orm Resource Locat or” (URL) Document Model Out line • All inf or mat ion in document s – Typically in Hypert ext Markup Language (HTML) • I nt roduct ion – Dif f erent t ypes: ASCI I , script s (done) < HTML> < !- Start of HTML document - -> • Document Model (next ) < BODY> < !- Start of the main body --> < H1> Hello World< /H1> < !- Basic text to be displayed -- > • Archit ect ure < /BODY> < !- End of main body --> < /HTML> < !- End of HTML section --> • Communicat ion < HTML> < !- Start of HTML document - -> • P < BODY> < !- Start of the main body --> rocesses < SCRIPT type = "text/javascript"> < !- identify scripting language - -> document.writeln ("< H1> Hello World< /H1> ); // Write a line of text • Naming < / SCRIPT> < !- End of scripting section --> < /BODY> < !- End of main body --> • Caching < /HTML> < !- End of HTML section --> • Secur it y • Scr ipt s give you “mobile code” (mor e lat er ) • Can also have Ext ensible Mar kup Language (XML) • P rovides st ruct ure t o document XML DTD XML Document (1) <!ELEMENT article (title, author+,journal)> (1) <?xml = version "1.0"> (# P CDATA is (2) <!DOCTYPE article SYSTEM "article.dtd"> (2) <!ELEMENT title (#PCDATA)> primit ive t ype, (3) <article> (3) <!ELEMENT author (name, affiliation?)> series of chars) (4) <title>Prudent Engineering Practice for Cryptographic Protocols</title> (4) <!ELEMENT name (#PCDATA)> (5) <author><name>M. Abadi</name></author> (5) <!ELEMENT affiliation (#PCDATA)> (6) <author><name>R. Needham</name></author> (6) <!ELEMENT journal (jname, volume, number?, month? pages, year)> (7) <journal> (7) <!ELEMENT jname (#PCDATA)> (8) <jname>IEEE Transactions on Software Engineering</jname> (8) <!ELEMENT volume (#PCDATA)> (9) <volume>22</volume> (10) <number>12</number> (9) <!ELEMENT number (#PCDATA)> (11) <month>January</month> (10) <!ELEMENT month (#PCDATA)> (12) <pages>6 – 15</pages> (11) <!ELEMENT pages (#PCDATA)> (13) <year>1996</year> (12) <!ELEMENT year (#PCDATA)> (14) </journal> (15) </article> • Def init ion above ref ers t o a j ournal art icle. Specif ies t ype. • An XML document using t he XML def init ions f rom previous – I n a Document Type Def init ion (DTD) slide – P rovides st ruct ure t o XML document s • Format t ing rules usually applied by embedding in HTML 1

  2. Document Types • Beyond t ext � can include ot her t ypes Out line – Mult ipurpose I nt ernet Mail Ext ensions (MI ME) Type Subtype Description • I nt roduct ion Text Plain Unformatted text (done) HTML Text including HTML markup commands • Document Model (done) XML Text including XML markup commands Image GIF Still image in GIF format • Archit ect ure (next ) JPEG Still image in JPEG format • Communicat ion Audio Basic Audio, 8 -bit PCM sampled at 8000 Hz Tone A specific audible tone • P rocesses Video MPEG Movie in MPEG format Pointer Representation of a pointer device for presentations • Naming Application Octet -stream An uninterrupted byte sequence • Caching Postscript A printable document in Postscript PDF A printable document in PDF • Secur it y Multipart Mixed Independent parts in the specified order Parallel Parts must be viewed simultaneously • I ncludes t ypes and sub-t ypes • Applicat ion specif ies applicat ion-specif ic dat a t ype Server -Side Script s Ar chit ect ur al Over view • Like Client , Ser ver can execut e J avaScr ipt • Text document s t ypically “pr ocessed” on client – But can be done at server, t oo (1) <HTML> • Common Gat eway I nt erf ace (CGI ) (2) <BODY> (3) <P>The current content of <pre>/data/file.txt</PRE>is:</P> (4) <P> (5) <SERVER type = "text/javascript"); (The t ag < SERVER… > (6) clientFile = new File("/data/file.txt"); is syst em specif ic) (7) if(clientFile.open("r")){ (8) while (!clientFile.eof()) (9) document.writeln(clientFile.readln()); (10) clientFile.close(); (11) } (12) </SERVER> (13) </P> (14) <P>Thank you for visiting this site.</P> (15) </BODY> (16) </HTML> • -compiled code � applet Ser ver can also pass pr e <OBJECT codetype=“application/java” classid=“java.welcome.class”> • Servlet s ar e applet s t hat r un on t he ser ver side (often with user input ie- form) Overall Archit ect ural Overview Out line • I nt roduct ion (done) • Document Model (done) • Archit ect ure (done) • Communicat ion (next ) • P rocesses • Naming • Caching • Secur it y 2

  3. HTTP Connect ions HTTP Met hods • Communication based on Hypertext Transfer Protocol (HTTP) • client request, server reply protocol Operation Description • uses TCP (why?_ Head Request t o ret urn t he header of a document G et Request t o ret urn a document t o t he client P ut Request t o st ore a document Provide dat a t hat is t o be added t o a document Post (collect ion) Delet e Request t o delet e a document • Head used t o ver if y obj ect , get t ime modif ied • Get can also r et r ieve only if mat ches t ags • Put • TCP connect ion set up expensive and Delet e used only if aut hor ized (secur it y a) Using nonpersist ent connect ions (HTTP 1.0) lat er ) b) Using persist ent connect ions (HTTP 1.1) • Can also have request s in parallel HTTP Messages: Client � Server HTTP Messages: Ser ver � Client • St at us code indicat es r esponse – 200 means honor request (“OK”) • Request line r equir ed – 400 (“Bad Request ”) • (Slide of addit ional header s lat er ) – 403 (“Forbidden”) – 404 (“Not Found”) Header Source Contents Accept Client The type of documents the client can handle HTTP Out line Accept-Charset Client Character sets are acceptable for the client Accept-Encoding Client Document encodings the client can handle Addit ional Accept-Language Client The natural language the client can handle Headers Authorization Client A list of the client's credentials • I nt roduct ion (done) WWW-Auth Server Security challenge to the client • Document Model Date Both Date and time the message was sent (done) ETag Server Tags associated with the returned document •Augment • Archit ect ure (done) Expires Server The time how long the response remains valid Client request or Server From Client The client's e -mail address • Communicat ion (done) Host Client The TCP address of the document's server Response If-Match Client The tags the document should have • P • Accept encoding rocesses (next ) If-None-Match Client The tags the document should not have of gzip • Naming If-Modified- Since Client Only return a document if newly modified • Upgrade to If-Unmodified- Return a document only if it has not been Secure HTTP Client • Caching Since modified since the specified time • Redirect for Last-Modified Server Time the returned document was last modified • Secur it y load balance Location Server Reference to which the client should redirect Referer Client Client's most recently requested document Upgrade Both App protocol the sender wants to switch to Warning Both Information about the status of the data 3

  4. Client Process: Ext ensible Browser Client -Side Process: Web Proxy • Need client browser t o be ext ensible • I nit ially, handle connect ion when browser does not “speak” – Plug-in language – Associat ed wit h document t ype (MI ME t ype) • I nit ially, handle connect ion when browser does not “speak” language • Now, most browsers can handle, but proxies st ill popular f or common cache f or many browsers • NZ, AOL Ser ver Clust er s (1) Ser ver s • Single server can become heavily loaded • Cor e invokes modules wit h dat a – Act ual module pat h depends upon dat a t ype • P hases: • – aut hent icat ion, response, synt ax checking, user- Fr ont -end replicat es request t o back-end (horizont al dist ribut ion) prof ile, t ransmission • Ext end ser ver t o suppor t dif f er ent t ypes (PHP) Ser ver Clust er s (2) Ser ver Clust er s (3) • Dist r ibut or t alks t o dispat cher init ially, t hen • The pr inciple of TCP handof f hands of f connect ion – But can’t t ake advant age of document knowledge or caching • Fr ont-end swit ch can st ay at TCP layer , t old wher e – But higher -layer has t o do more work, making f ront -end a bot t leneck t o send dat a 4

Recommend


More recommend