Title: CS4513 Distributed Computer Systems
1CS4513Distributed Computer Systems
2The World Wide Web
- Huge client-server system
- Document-based
- Referenced by Uniform Resource Locator (URL)
3Outline
- Introduction (done)
- Document Model (next)
- Architecture
- Communication
- Processes
- Naming
- Caching
- Security
4Document Model
- All information in documents
- Typically in Hypertext Markup Language (HTML)
- Different types ASCII, scripts
ltHTMLgt lt!- Start of HTML document
--gtltBODYgt lt!- Start of the main body
--gtltH1gtHello Worldlt/H1gt lt!- Basic text to be
displayed --gtlt/BODYgt lt!- End of main
body --gtlt/HTMLgt lt!- End of HTML
section --gt ltHTMLgt lt!- Start of HTML document
--gtltBODYgt lt!- Start of the main body
--gtltSCRIPT type "text/javascript"gt lt!-
identify scripting language --gt
document.writeln ("ltH1gtHello Worldlt/H1gt) //
Write a line of textlt/SCRIPTgt lt!- End of
scripting section --gtlt/BODYgt lt!- End of main
body --gtlt/HTMLgt lt!- End of HTML section --gt
- Scripts give you mobile code (more later)
- Can also have Extensible Markup Language (XML)
- Provides structure to document
5XML DTD
(1) lt!ELEMENT article (title, author,journal)gt(2
) lt!ELEMENT title (PCDATA)gt(3) lt!ELEMENT
author (name, affiliation?)gt(4) lt!ELEMENT name
(PCDATA)gt(5) lt!ELEMENT affiliation
(PCDATA)gt(6) lt!ELEMENT journal (jname, volume,
number?, month? pages, year)gt(7) lt!ELEMENT
jname (PCDATA)gt(8) lt!ELEMENT volume
(PCDATA)gt(9) lt!ELEMENT number (PCDATA)gt(10)
lt!ELEMENT month (PCDATA)gt(11) lt!ELEMENT pages
(PCDATA)gt(12) lt!ELEMENT year (PCDATA)gt
(PCDATA is primitive type, series of chars)
- Definition above refers to a journal article.
Specifies type. - In a Document Type Definition (DTD)
- Provides structure to XML documents
6XML Document
(1) lt?xml version "1.0"gt(2) lt!DOCTYPE article
SYSTEM "article.dtd"gt(3) ltarticlegt(4)
lttitlegtPrudent Engineering Practice for
Cryptographic Protocolslt/titlegt(5)
ltauthorgtltnamegtM. Abadilt/namegtlt/authorgt(6)
ltauthorgtltnamegtR. Needhamlt/namegtlt/authorgt(7)
ltjournalgt(8) ltjnamegtIEEE Transactions on
Software Engineeringlt/jnamegt(9) ltvolumegt22lt/volu
megt(10) ltnumbergt12lt/numbergt(11) ltmonthgtJanuary
lt/monthgt(12) ltpagesgt6 15lt/pagesgt(13) ltyeargt1
996lt/yeargt(14) lt/journalgt(15) lt/articlegt
- An XML document using the XML definitions from
previous slide - Formatting rules usually applied by embedding in
HTML
7Document Types
- Beyond text ? can include other types
- Multipurpose Internet Mail Extensions (MIME)
- Includes types and sub-types
- Application specifies application-specific data
type
8Outline
- Introduction (done)
- Document Model (done)
- Architecture (next)
- Communication
- Processes
- Naming
- Caching
- Security
9Architectural Overview
- Text documents typically processed on client
- But can be done at server, too
- Common Gateway Interface (CGI)
(often with user input ie- form)
10Server-Side Scripts
- Like Client, Server can execute JavaScript
(1) ltHTMLgt(2) ltBODYgt(3) ltPgtThe current content
of ltpregt/data/file.txtlt/PREgtislt/Pgt(4) ltPgt(5) ltS
ERVER type "text/javascript")(6)
clientFile new File("/data/file.txt")(7)
if(clientFile.open("r"))(8) while
(!clientFile.eof())(9) document.writeln(cli
entFile.readln())(10) clientFile.close()(11)
(12) lt/SERVERgt(13) lt/Pgt(14) ltPgtThank you
for visiting this site.lt/Pgt(15) lt/BODYgt(16) lt/HT
MLgt
(The tag ltSERVERgt is system specific)
- Server can also pass pre-compiled code ? applet
- ltOBJECT codetypeapplication/java
classidjava.welcome.classgt - Servlets are applets that run on the server side
11Overall Architectural Overview
12Outline
- Introduction (done)
- Document Model (done)
- Architecture (done)
- Communication (next)
- Processes
- Naming
- Caching
- Security
13HTTP Connections
- Communication based on Hypertext Transfer
Protocol (HTTP) - client request, server reply protocol
- uses TCP (why?_
- TCP connection setup expensive
- Using nonpersistent connections (HTTP 1.0)
- Using persistent connections (HTTP 1.1)
- Can also have requests in parallel
14HTTP Methods
- Head used to verify object, get time modified
- Get can also retrieve only if matches tags
- Put and Delete used only if authorized (security
later)
15HTTP Messages Client?Server
- Request line required
- (Slide of additional headers later)
16HTTP Messages Server?Client
- Status code indicates response
- 200 means honor request (OK)
- 400 (Bad Request)
- 403 (Forbidden)
- 404 (Not Found)
17HTTP Additional Headers
- Augment
- Client request
- or Server
- Response
- Accept encoding
- of gzip
- Upgrade to
- Secure HTTP
- Redirect for
- load balance
18Outline
- Introduction (done)
- Document Model (done)
- Architecture (done)
- Communication (done)
- Processes (next)
- Naming
- Caching
- Security
19Client Process Extensible Browser
- Need client browser to be extensible
- Plug-in
- Associated with document type (MIME type)
20Client-Side Process Web Proxy
- Initially, handle connection when browser does
not speak language
- Initially, handle connection when browser does
not speak language - Now, most browsers can handle, but proxies still
popular for common cache for many browsers - NZ, AOL
21Servers
- Core invokes modules with data
- Actual module path depends upon data type
- Phases
- authentication, response, syntax checking,
user-profile, transmission - Extend server to support different types (PHP)
22Server Clusters (1)
- Single server can become heavily loaded
- Front-end replicates request to back-end
(horizontal distribution)
23Server Clusters (2)
- The principle of TCP handoff
- But cant take advantage of document knowledge or
caching - But higher-layer has to do more work, making
front-end a bottleneck
24Server Clusters (3)
- Distributor talks to dispatcher initially, then
hands off connection - Front-end switch can stay at TCP layer, told
where to send data
25Outline
- Introduction (done)
- Document Model (done)
- Architecture (done)
- Communication (done)
- Processes (done)
- Naming (naming)
- Caching
- Security
26Uniform Resource Locators
- Location-specific document location.
- Using only a DNS name (lookup IP, default port)
- Combining a DNS name with a port number (lookup
IP). - Combining an IP address with a port number.
- Note tricks with DNS for load balancing
27URL Examples
28Uniform Resource Names (URN)
- Location independent document specification
- Easy to define name spaces, but hard to resolve
- No general mechanisms
- URL URN URI
- Uniform Resource Identifier
29Outline
- Introduction (done)
- Document Model (done)
- Architecture (done)
- Communication (done)
- Processes (done)
- Naming (done)
- Caching (next)
- Security
30Web Caching
- Browser keeps recent requests
- Proxy can be valuable if shared interests
- Check cache first, server next
- Cache is full. How to decide replacement?
- LRU (what is different than pages or disk
blocks?) - GreedyDual (value divided by size)
- How consistent should the cache be to the server
content? What are the tradeoffs?
31Cache Coherency
- Strong consistency
- validate each access
- server indicates if invalid
- but requires request to server for each client
request - Weak consistency
- validate only when client clicks refresh
- Or, using a heuristic Time To Live (TTL)
- Squid Texpire ?(Tcached Tlast_modified)
Tcached - ? 0.2 (derived from practice)
- Why not have server push invalidation?
- In practice, cache hits low (50 max, only if
really large) - Make cooperative caches
32Cooperative Web Proxy Caching
- Proxy first checks neighbors before asking server
- Shown effective for 10,000 user
- But complicated, and often not a clear win over
single proxy
33Misc Caching
- Static vs. Dynamic Documents
- Caching only effective for static documents (non
CGI) - But Web increasingly dynamic (personalized)
- Cookies used since server (mostly) stateless
- Make proxies support active caching
- Generate the HTML
- Need copies of server-side scripts/code
- Accessing databases harder
- Caching large documents
- Can only send changes from original
- Often, connection request is the large cost
34Server Replication
- Clusters (covered)
- Deploy entire copy of Web site at another site
(mirror) - Often done with FTP servers
- Non-transparent
- Content Delivery Network (CDN)
- Have network of cooperative caches run by the
provider
35Akamai CDN
- Embedded documents have names that are resolved
by Akamai DNS to a local CDN server - Use Internet map to determine local server
- Local server gets copy from original server
- Akamai has many CDN servers close to clients
36Outline
- Introduction (done)
- Document Model (done)
- Architecture (done)
- Communication (done)
- Processes (done)
- Naming (done)
- Caching (done)
- Security (next)
- Secure Socket Layer (SSL)
37Security Secure Communication Channel
- Need secure channel for transactions
- Netscapes Secure Socket Layer (SSL)
- More recent Transport Security Layer (TSL)
- Application independent
- Sits above transport layer
- Invoked by scheme https
38Establishing an SSL connection
- Client sends SSL version number, cipher settings,
randomly generated data and other information
server needs. - Server sends server SSL version number, cipher
settings, randomly generated data, servers own
certificate. - (Optional) Server may request client's
certificate. Client authenticates server
certificate by using public key of certificate
authority (CA) - Client creates premaster key for session and
encrypts it with servers public key (obtained
from server's certificate) and sends to server. - (Optional) Client sends encrypted data based on
own private key if client needs authentication. - Server generates master secret, sends to server
- Both client and server use master secret to
generate session keys, which are symmetric keys
for encryption/decryption of exchanged
information during SSL session. - Client and server inform each other session key
has been created. - SSL handshake is complete.