Web Caches (Proxy Servers) - Application Layer - PDF

Document Details

AppreciatedBronze2230

Uploaded by AppreciatedBronze2230

Tags

web caching proxy servers network protocols computer networking

Summary

This document discusses web caching and proxy servers, explaining their role in network applications. It covers concepts like client-server interactions, response times, and network traffic reduction. The document also provides an overview of various caching mechanisms.

Full Transcript

Web caches (proxy servers) Goal: satisfy client request without involving origin server ▪ user configures browser to point to a Web cache proxy ▪ browser sends all HTTP server requests to cache client...

Web caches (proxy servers) Goal: satisfy client request without involving origin server ▪ user configures browser to point to a Web cache proxy ▪ browser sends all HTTP server requests to cache client origin if object in cache: cache server returns object to client else cache requests object from origin server, caches received object, then client returns object to client origin server Application Layer: 2-1 Web caches (proxy servers) ▪ Web cache acts as both Why Web caching? client and server ▪ reduce response time for client server for original request requesting client cache is closer to client client to origin server ▪ reduce traffic on an institution’s ▪ typically cache is access link installed by ISP (university, company, residential ISP) Application Layer: 2-2 Caching example Scenario: ▪ access link rate: 1.54 Mbps origin ▪ RTT from institutional router to server: 2 sec servers ▪ Web object size: 100K bits public Internet ▪ Average request rate from browsers to origin servers: 15/sec ▪ average data rate to browsers: 1.50 Mbps 1.54 Mbps Performance: access link problem: large ▪ LAN utilization:.0015 delays at high institutional network ▪ access link utilization =.97 utilization! 1 Gbps LAN ▪ end-end delay = Internet delay + access link delay + LAN delay = 2 sec + ? + usecs Application Layer: 2-3 Caching example Scenario: ▪ access link rate: 1.54 Mbps origin ▪ RTT from institutional router to server: 2 sec servers ▪ Web object size: 100K bits public Internet ▪ Average request rate from browsers to origin servers: 15/sec ▪ average data rate to browsers: 1.50 Mbps 1.54 Mbps Performance: access link Transmission delay over the access link and LAN: institutional network 1 Gbps LAN Application Layer: 2-4 Caching example: buy a faster access link Scenario: 154 Mbps ▪ access link rate: 1.54 Mbps origin ▪ RTT from institutional router to server: 2 sec servers ▪ Web object size: 100K bits public Internet ▪ Avg request rate from browsers to origin servers: 15/sec ▪ avg data rate to browsers: 1.50 Mbps 154 Mbps 1.54 Mbps Performance: access link ▪ LAN utilization: ? institutional network ▪ access link utilization = ? 1 Gbps LAN ▪ end-end delay = Internet delay + access link delay + LAN delay = 2 sec + seconds + usecs Cost: faster access link (expensive!) msecs Application Layer: 2-6 Caching example: install a web cache Scenario: ▪ access link rate: 1.54 Mbps origin ▪ RTT from institutional router to server: 2 sec servers ▪ Web object size: 100K bits public Internet ▪ Avg request rate from browsers to origin servers: 15/sec ▪ avg data rate to browsers: 1.50 Mbps 1.54 Mbps Performance: access link ▪ LAN utilization:.? How to compute link institutional network ▪ access link utilization = ? utilization, delay? 1 Gbps LAN ▪ average end-end delay = ? Cost: web cache (cheap!) local web cache Application Layer: 2-7 Caching example: install a web cache Calculating access link utilization, end- end delay with cache: origin ▪ suppose cache hit rate is 0.4: 40% requests servers satisfied at cache, 60% requests satisfied at public Internet origin ▪ access link: 60% of requests use access link ▪ data rate to browsers over access link 1.54 Mbps = 0.6 * 1.50 Mbps =.9 Mbps access link ▪ utilization = 0.9/1.54 =.58 institutional network ▪ average end-end delay 1 Gbps LAN = 0.6 * (delay from origin servers) + 0.4 * (delay when satisfied at cache) = 0.6 (2.01) + 0.4 (~msecs) = ~ 1.2 secs local web cache lower average end-end delay than with 154 Mbps link (and cheaper too!) Application Layer: 2-9 Conditional GET client server Goal: don’t send object if cache has HTTP request msg up-to-date cached version If-modified-since: object not no object transmission delay modified lower link utilization HTTP response before HTTP/1.0 ▪ cache: specify date of cached copy 304 Not Modified in HTTP request If-modified-since: HTTP request msg ▪ server: response contains no If-modified-since: object object if cached copy is up-to-date: modified HTTP response after HTTP/1.0 304 Not Modified HTTP/1.0 200 OK Application Layer: 2-10 HTTP/2 Key goal: decreased delay in multi-object HTTP requests HTTP1.1: introduced multiple, pipelined GETs over single TCP connection ▪ server responds in-order (FCFS: first-come-first-served scheduling) to GET requests ▪ with FCFS, small object may have to wait for transmission (head-of- line (HOL) blocking) behind large object(s) ▪ loss recovery (retransmitting lost TCP segments) stalls object transmission Application Layer: 2-11 HTTP/2 Key goal: decreased delay in multi-object HTTP requests HTTP/2: [RFC 7540, 2015] increased flexibility at server in sending objects to client: ▪ methods, status codes, most header fields unchanged from HTTP 1.1 ▪ transmission order of requested objects based on client-specified object priority (not necessarily FCFS) ▪ push unrequested objects to client ▪ divide objects into frames, schedule frames to mitigate HOL blocking Application Layer: 2-12 HTTP/2: mitigating HOL blocking HTTP 1.1: client requests 1 large object (e.g., video file, and 3 smaller objects) server GET O4 GET O3 GET O 2 GET O1 object data requested client O1 O2 O1 O3 O2 O3 O4 O4 objects delivered in order requested: O2, O3, O4 wait behind O1 Application Layer: 2-13 HTTP/2: mitigating HOL blocking HTTP/2: objects divided into frames, frame transmission interleaved server GET O4 GET O3 GET O 2 GET O1 object data requested client O2 O4 O3 O1 O2 O3 O1 O4 O2, O3, O4 delivered quickly, O1 slightly delayed Application Layer: 2-14 HTTP/2 to HTTP/3 Key goal: decreased delay in multi-object HTTP requests HTTP/2 over single TCP connection means: ▪ recovery from packet loss still stalls all object transmissions as in HTTP 1.1, browsers have incentive to open multiple parallel TCP connections to reduce stalling, increase overall throughput ▪ no security over vanilla TCP connection ▪ HTTP/3: adds security , per object error- and congestion- control (more pipelining) over UDP more on HTTP/3 in transport layer Application Layer: 2-15 Application layer: overview ▪ P2P applications ▪ Principles of network ▪ video streaming and content applications distribution networks ▪ Web and HTTP ▪ socket programming with ▪ E-mail, SMTP, IMAP UDP and TCP ▪ The Domain Name System DNS Application Layer: 2-16 outgoing E-mail message queue user mailbox user Three major components: agent ▪ user agents mail user server ▪ mail servers agent ▪ simple mail transfer protocol: SMTP SMTP mail user server agent SMTP User Agent SMTP user ▪ a.k.a. “mail reader” mail agent server ▪ composing, editing, reading mail messages user ▪ e.g., Outlook, iPhone mail client agent user ▪ outgoing, incoming messages stored on agent server Application Layer: 2-17 outgoing E-mail: mail servers message queue user mailbox user mail servers: agent ▪ mailbox contains incoming mail server user agent messages for user SMTP mail user ▪ message queue of outgoing (to server agent be sent) mail messages SMTP ▪ SMTP protocol between mail SMTP user agent servers to send email messages mail server client: sending mail server user agent “server”: receiving mail server user agent Application Layer: 2-18 E-mail: the RFC (5321) Application Layer: 2-19 Scenario: Alice sends e-mail to Bob 1) Alice uses UA to compose e-mail 4) SMTP client sends Alice’s message message “to” [email protected] over the TCP connection 2) Alice’s UA sends message to her 5) Bob’s mail server places mail server; message placed in the message in Bob’s message queue mailbox 3) client side of SMTP opens TCP 6) Bob invokes his user connection with Bob’s mail server agent to read message 1 user mail user mail agent agent server server 2 3 6 4 5 Alice’s mail server Bob’s mail server Application Layer: 2-20 Sample SMTP interaction S: 220 hamburger.edu C: HELO crepes.fr S: 250 Hello crepes.fr, pleased to meet you C: MAIL FROM: S: 250 [email protected]... Sender ok C: RCPT TO: S: 250 [email protected]... Recipient ok C: DATA S: 354 Enter mail, end with "." on a line by itself C: Do you like ketchup? C: How about pickles? C:. S: 250 Message accepted for delivery C: QUIT S: 221 hamburger.edu closing connection Application Layer: 2-21 Application Layer: Overview ▪ P2P applications ▪ Principles of network ▪ video streaming and content applications distribution networks ▪ Web and HTTP ▪ socket programming with ▪ E-mail, SMTP, IMAP UDP and TCP ▪ The Domain Name System DNS Application Layer: 2-26 DNS: Domain Name System people: many identifiers: SSN, name, passport # Internet hosts, routers: IP address (32 bit) - used for addressing datagrams “name”, e.g., cs.umass.edu - used by humans Q: how to map between IP address and name, and vice versa ? Application Layer: 2-28 DNS: Domain Name System people: many identifiers: Domain Name System: SSN, name, passport # A centralized database Internet hosts, routers: IP address (32 bit) - used for addressing datagrams “name”, e.g., cs.umass.edu - used by humans Q: how to map between IP address and name, and vice versa ? Application Layer: 2-29 DNS: Domain Name System Application Layer: 2-30 DNS: Domain Name System Domain Name System provides following services: 1. Hostname to ip address translation Application Layer: 2-31 DNS: Domain Name System Domain Name System provides following services: 2. Host aliasing The canonical name for a Yahoo server might be “relay1.west-coast.yahoo.com”, but users might just want to access “yahoo.com” as a more memorable and user-friendly domain. CNAME (Canonical Name Record) is used in the DNS to map the alias (yahoo.com) to the canonical name (relay1.west-coast.yahoo.com) Application Layer: 2-32 DNS: Domain Name System Domain Name System provides following services: 3. Load distribution If there are multiple yahoo servers and multiple clients are accessing these servers, DNS manage load distribution to avoid overloading of a specific server. Normally DNS pick first IP address as shown After accessing the first IP address the DNS server reshuffle the IP addresses as: Application Layer: 2-33 DNS: Domain Name System Domain Name System provides following services: 3. Load distribution Application Layer: 2-34 DNS: services, structure Domain Name System: Q: Why not centralize DNS? ▪ distributed database implemented in ▪ single point of failure hierarchy of many name servers ▪ traffic volume ▪ application-layer protocol: hosts, ▪ distant centralized database name servers communicate to resolve ▪ Maintenance names (address/name translation) ▪ Security note: core Internet function, implemented as application-layer ▪ Because of these reasons we protocol have to opt Distributed DNS (distributed database ) ▪ (Next slide) Application Layer: 2-35 Distributed database Application Layer: 2-36 DNS: a distributed, hierarchical database Root DNS Servers Root … ….com DNS servers.org DNS servers.edu DNS servers Top Level Domain … … … … yahoo.com amazon.com pbs.org nyu.edu umass.edu DNS servers DNS servers DNS servers DNS servers DNS servers Authoritative Client wants IP address for www.amazon.com; 1st approximation: ▪ client queries root server to find.com DNS server ▪ client queries.com DNS server to get amazon.com DNS server ▪ client queries amazon.com DNS server to get IP address for www.amazon.com Application Layer: 2-37 DNS: root name servers Application Layer: 2-38 TLD: authoritative servers Top-Level Domain (TLD) servers: ▪ responsible for.com,.org,.net,.edu,.aero,.jobs,.museums, and all top-level country domains, e.g.:.cn,.uk,.fr,.ca,.jp ▪ Network Solutions: authoritative registry for.com,.net TLD ▪ Educause:.edu TLD Authoritative DNS servers: ▪ organization’s own DNS server(s), providing authoritative hostname to IP mappings for organization’s named hosts ▪ can be maintained by organization or service provider Application Layer: 2-39 Local DNS name servers ▪ Does not strictly belong to DNS hierarchy ▪ Each ISP (residential ISP, company, university) has one also called “default name server” ▪ When host makes DNS query, query is sent to its local DNS server has local cache of recent name-to-address translation pairs (but may be out of date!) acts as proxy, forwards query into hierarchy Application Layer: 2-40 DNS name resolution: iterated query root DNS server Example: host at engineering.nyu.edu wants IP address for gaia.cs.umass.edu 2 3 TLD DNS server Iterated query: 1 4 ▪ contacted server replies 8 5 with name of server to requesting host at local DNS server contact engineering.nyu.edu dns.nyu.edu gaia.cs.umass.edu ▪ “I don’t know this name, 7 6 but ask this server” authoritative DNS server dns.cs.umass.edu Application Layer: 2-41 DNS name resolution: recursive query root DNS server Example: host at engineering.nyu.edu wants IP address for gaia.cs.umass.edu 2 3 7 6 Recursive query: 1 TLD DNS server ▪ puts burden of name 8 resolution on requesting host at local DNS server 5 4 engineering.nyu.edu dns.nyu.edu contacted name gaia.cs.umass.edu server ▪ heavy load at upper authoritative DNS server levels of hierarchy? dns.cs.umass.edu Application Layer: 2-43 File distribution: client-server vs P2P Q: how much time to distribute file (size F) from one server to N peers? peer upload/download capacity is limited resource us: server upload capacity di: peer i download file, size F u1 d1 u2 capacity us d2 server di uN network (with abundant bandwidth) ui dN ui: peer i upload capacity Introduction: 1-44 File distribution time: client-server ▪ server transmission: must sequentially send (upload) N file copies: F time to send one copy: F/us us time to send N copies: NF/us di network ui ▪ client: each client must download file copy dmin = min client download rate min client download time: F/dmin time to distribute F to N clients using Dc-s > max{NF/us,,F/dmin} client-server approach increases linearly in N Introduction: 1-45 File distribution: client-server vs P2P Q: how much time to distribute file (size F) from one server to N peers? peer upload/download capacity is limited resource Introduction: 1-46 File distribution time: P2P ▪ server transmission: must upload at least one copy: F time to send one copy: F/us us ▪ client: each client must download di network file copy ui min client download time: F/dmin ▪ clients: as aggregate must download NF bits max upload rate (limiting max download rate) is us + Sui time to distribute F to N clients using DP2P > max{F/us,,F/dmin,,NF/(us + Sui)} P2P approach increases linearly in N … … but so does this, as each peer brings service capacity Application Layer: 2-47 Client-server vs. P2P: example client upload rate = u, F/u = 1 hour, us = 10u, dmin ≥ us 3.5 P2P Minimum Distribution Time 3 Client-Server 2.5 2 1.5 1 0.5 0 0 5 10 15 20 25 30 35 N Application Layer: 2-48 P2P file distribution: BitTorrent ▪ file divided into 256Kb chunks ▪ peers in torrent send/receive file chunks tracker: tracks peers torrent: group of peers participating in torrent exchanging chunks of a file Alice arrives … … obtains list of peers from tracker … and begins exchanging file chunks with peers in torrent Application Layer: 2-49 P2P file distribution: BitTorrent ▪ peer joining torrent: has no chunks, but will accumulate them over time from other peers registers with tracker to get list of peers, connects to subset of peers (“neighbors”) ▪ while downloading, peer uploads chunks to other peers ▪ peer may change peers with whom it exchanges chunks ▪ churn: peers may come and go ▪ once peer has entire file, it may (selfishly) leave or (altruistically) remain in torrent Application Layer: 2-50 BitTorrent: requesting, sending file chunks Initial Setup: Requesting chunks: Alice connects to 4 peers: Peer A, Peer B, Peer C, ▪ at any given time, different and Peer D. Peer A has chunks 1, 2, 3, 4. peers have different Peer B has chunks 2, 3, 5. subsets of file chunks Peer C has chunks 1, 4, 6. Peer D has chunks 3, 5, 7. ▪ periodically, Alice asks each peer for list of chunks After compiling the lists, Alice finds that:Chunk 6 that they have is only available from Peer C. ▪ Alice requests missing Chunk 7 is only available from Peer D. Chunks 1, 4, 5, and 2 are more common chunks from peers, rarest among multiple peers. first Application Layer: 2-51 BitTorrent: requesting, sending file chunks Sending chunks: tit-for-tat ▪ Alice sends chunks to those four Alice is downloading a file divided into 20 chunks. She is connected to 6 peers (Peer A, Peer B, Peer C, Peer D, Peer E, peers currently sending her chunks and Peer F) and has the following upload rates from each peer at highest rate (in chunks per second) over the last 10 seconds: other peers are choked by Alice (do Peer A: 2 chunks/second Peer B: 1 chunk/second not receive chunks from her) Peer C: 0.5 chunks/second re-evaluate top 4 every10 secs Peer D: 3 chunks/second Peer E: 2 chunks/second ▪ every 30 secs: randomly select Peer F: 1.5 chunks/second another peer, starts sending chunks “optimistically unchoke” this peer newly chosen peer may join top 4 Application Layer: 2-52 BitTorrent: requesting, sending file chunks Sending chunks: tit-for-tat ▪ Alice sends chunks to those four Alice is downloading a file divided into 20 chunks. She is connected to 6 peers (Peer A, Peer B, Peer C, Peer D, Peer E, peers currently sending her chunks and Peer F) and has the following upload rates from each peer at highest rate (in chunks per second) over the last 10 seconds: other peers are choked by Alice (do Peer A: 2 chunks/second Peer B: 1 chunk/second not receive chunks from her) Peer C: 0.5 chunks/second re-evaluate top 4 every10 secs Peer D: 3 chunks/second Peer E: 2 chunks/second ▪ every 30 secs: randomly select Peer F: 1.5 chunks/second another peer, starts sending chunks “optimistically unchoke” this peer newly chosen peer may join top 4 Application Layer: 2-53 BitTorrent: tit-for-tat (1) Alice “optimistically unchokes” Bob (2) Alice becomes one of Bob’s top-four providers; Bob reciprocates (3) Bob becomes one of Alice’s top-four providers higher upload rate: find better trading partners, get file faster ! Application Layer: 2-54 Class Activity Alice is downloading a file divided into 40 chunks. She is connected to 6 peers (Peer A, Peer B, Peer C, Peer D, Peer E, and Peer F) and has the following upload rates from each peer (in chunks per second) over the last 10 seconds: Peer A: 2 chunks/second Peer B: 1 chunk/second Peer C: 0.5 chunks/second Peer D: 3 chunks/second Peer E: 2 chunks/second Peer F: 1.5 chunks/second Question 1: After evaluating the upload rates, which 4 peers will Alice send chunks to based on the tit-for-tat strategy? Question 2: If Alice decides to optimistically unchoke Peer C for the next 30 seconds and discovers that Peer C starts sending her chunks at a rate of 1 chunk/second, how would Alice's top peers change after the next evaluation (if the rates remain constant)? Question 3: After 30 seconds, if Alice sends chunks to her top 4 peers for the entire duration, how many chunks would each peer receive from Alice if she sends at a constant rate of 1 chunk/second to each peer? Application Layer: 2-55

Use Quizgecko on...
Browser
Browser