SlideShare a Scribd company logo
1 of 41
Download to read offline
Lecture 12: Queuing, Caching, and Content 
Distribution
Overview 
 How routers queue affects how TCP and other 
protocols behave 
 Two router questions: drop policy, scheduling 
policy 
 Reducing congestion through content distribution 
- Clients can cache 
- Services can use a CDN
Congestion Control Revisited 
 Congestion is when the input rate  output rate 
- In TCP, flow control window ensures sender does not 
exceed rate at which receiver consumes data 
- What if senders exceed a router’s maximum output rate? 
 What should routers do? Make sender slow down 
 TCP sending rate = window-size=RTT, so 2 options: 
1. Increase RTT – buffer more packets =)more queuing delay 
2. Reduce window size – happens if router drops packets 
 Recall TCP reacts to packet loss by shrinking 
congestion window 
- Triple duplicate ack: halve window, enter CA state 
- Timeout: set window to 1, enter SS state
Congestion at Router 
Destination 
1.5-Mbps T1 link 
Router 
Source 
1 
Source 
2 
10-Mbps Ethernet 
100-Mbps FDDI 
 Router goals 
- Prioritize who gets limited resources 
- Somehow interact well with TCP
Router design issues 
 Scheduling discipline 
- Which of multiple packets should you send next? 
- May want to achieve some notion of fairness 
- May want some packets to have priority 
 Drop policy 
- When should you discard a packet? 
- Which packet to discard? 
- Some packets more important (perhaps BGP) 
- Some packets useless w/o others (IP fragments) 
 Need to balance throughput  delay 
- Could minimize/eliminate drops with enormous buffers 
- But queuing delay highly frowned upon (interactive apps)
Example: FIFO tail drop 
Arriving 
packet 
Next free 
buffer 
Next to 
transmit 
Free buffers Queued packets 
(a) 
Arriving 
packet 
Next to 
transmit 
(b) Drop 
 Differentiates packets only by when they arrive 
- Packet dropped if queue full when it arrives
Tail drop issues 
 When stable, queue will always be nearly full 
- Guarantees high latency for all traffic 
 Possibly unfair for flows with small windows 
- E.g., small flow ( 4 segments) may be stuck in backoff, 
while larger flows can use fast retransmit to recover 
 Window synchronization 
- Consider many flows in a stable configuration 
- New flow comes in, causes a bunch of packet losses 
- Existing flows all cut their windows together 
(underutilizing link) 
- Flows all grow their windows together until link again 
overloaded and many packets lost. Repeat. . .
What to optimize for? 
 Fairness (in two slides) 
 High throughput – queue should never be empty 
 Low delay – so want short queues 
 Crude combination: power = Throughput=Delay 
- Want to convince hosts to offer optimal load 
Optimal 
load 
Load 
Throughput/delay
Connectionless flows 
Router 
Source 
1 
Source 
2 
Source 
3 
Router 
Router 
Destination 
1 
Destination 
2 
 Even in Internet, routers can have a notion of flows 
- E.g., base on IP addresses  TCP ports (or hash of those) 
- Soft state—doesn’t have to be correct 
- But if often correct, can use to form router policies
Fairness 
 What is fair in this situation? 
- Each flow gets 1=2 link b/w? Long flow gets less? 
 Usually fair means equal 
- For flow bandwidths (x1; : : : ; xn), fairness index: 
f(x1; : : : ; xn) = 
( 
Pn 
i=1 xi)2 
n 
Pn 
i=1 x2i 
- If all xis are equal, fairness is one 
- Weighted fairness is a simple extension 
 So what policy should routers follow?
Scheduling Policy: Fair Queuing (FQ) 
 Explicitly segregates traffic based on flows 
 Ensures no flow consumes more than its share 
- Variation: weighted fair queuing (WFQ) 
 Note: if all packets were same length, would be easy 
Flow 1 
Flow 2 
Flow 3 
Flow 4 
Round-robin 
service
Fair Queuing Basics 
 Keep track of how much time each flow has used 
link 
 Compute how long a flow will have used link if it 
transmits next packet 
 Send packet from flow which will have lowest use 
if it transmits 
- Why not flow with smallest use so far? 
- Because next packet may be huge (examples coming)
FQ Algorithm 
 Suppose clock ticks each time a bit is transmitted 
 Pi: length of packet i 
 Si: time when packet i started transmission 
 Fi: time when packet i finished transmission 
 Fi = Si + Pi 
 When does router start transmitting packet i? 
- If arrived before router finished packet i  1 from this flow, then 
immediately after last bit of i  1 (Fi1) 
- If no current packets for this flow, then start transmitting when 
arrives (call this Ai) 
 Thus: Fi = max(Fi1;Ai) + Pi
FQ Algorithm (cont) 
 For multiple flows 
- Calculate Fi for each packet that arrives on each flow 
- Treat all Fis as timestamps 
- Next packet to transmit is one with lowest timestamp 
 Not perfect: can’t preempt current packet 
 Example: 
Flow 1 Flow 2 
Flow 1 
(arriving) 
Output Output 
(a) (b) 
F = 8 F = 10 
F = 5 
F = 10 
F = 2 
Flow 2 
(transmitting)
FQ Algorithm (cont) 
 One complication: inactive flows are penalized 
(Ai  Fi1) 
 Over what interval do you consider fairness? 
- Standard algorithm considers no history 
- Each flow gets fair share while packets queued 
 Solution: Bi = Pi + max(Fi1;Ai  ) 
  = interval of history to consider
Fair Queueing Importance 
 “Our packet-by-packet transmission algorithm is 
simply defined by the rule that, whenever a packet 
finishes transmission, the next packet is the one 
with the smallest F 
i .” 
 But, fair queueing not used in core routers: finding 
min F in hundreds of thousands of flows is 
expensive. Can be used on edge routers and low 
speed links.
Drop Policy: Random Early Detection (RED) 
 Notification of congestion is implicit in Internet 
- Just drop the packet (TCP will timeout) 
- Could make explicit by marking the packet 
(ECN extension to IP allows routers to mark packets) 
 Early random drop 
- Don’t wait for full queue to drop packet 
- Instead, drop packets with some drop probability whenever 
the queue length exceeds some drop level 
- Prevents global window synchronization: many TCP flows 
speed up, all have packets dropped, all slow down, etc.
RED Details 
 Compute average queue length 
- AvgLen = (1 Weight)  AvgLen +Weight  SampleLen 
- 0  Weight  1 (usually 0.002) 
 SampleLen is queue length each time a packet arrives 
MaxThreshold MinThreshold 
AvgLen
AvgLen 
Queue length 
Instantaneous 
Average 
Time 
 Smooths out AvgLen over time 
- Don’t want to react to instantaneous fluctuations
RED Details (cont) 
 Two queue length thresholds: 
if AvgLen = MinThreshold then 
enqueue the packet 
if MinThreshold  AvgLen  MaxThreshold then 
calculate probability P 
drop arriving packet with probability P 
if MaxThreshold = AvgLen then 
drop arriving packet
RED Details (cont) 
 Computing probability P 
- Pb = MaxP  (AvgLenMinThreshold) 
(MaxThresholdMinThreshold) 
P(drop) 
1.0 
MaxP 
MinThresh MaxThresh 
AvgLen 
 Actual drop probability based on time since last drop 
- count = # pkts since drop or MinThresh  Avglen  MaxThresh 
- P = Pb=(1  count  Pb) 
- Space out drops, separate when to drop from which to drop
What P looks like 
1 
0.8 
Pb=0.05 
Pb=0.01 
drop 
of 0.6 
Probability 0.4 
0.2 
0 
Count since last drop 0 10 20 30 40 50 60 70 80 90
Tuning RED 
- Probability of dropping a particular flow’s packet(s) is roughly 
proportional to the share of the bandwidth that flow is 
currently getting 
- MaxP is typically set to 0.02 
- If traffic is bursty, then MinThreshold should be sufficiently 
large to allow link utilization to be maintained at an acceptably 
high level 
- Difference between two thresholds should be larger than the 
typical increase in the calculated average queue length in one 
RTT; setting MaxThreshold to twice MinThreshold is 
reasonable for traffic on today’s Internet
Queueing Today 
 Cisco IOS 
- Scheduling: FIFO, FQ, WFQ, Custom queueing (patterns) 
- Drop policy: Tail drop, weighted random early detection 
 The buffer bloat problem (DSL/Cable modems, 
WiFi drivers, etc.)
2-minute stretch
Content distribution 
 How can end nodes reduce load on bottleneck links? 
- Congestion makes net slower – nobody wants this 
 Client side 
- Many people from Stanford might access same web page 
- Redundant downloads a bad use of Stanford’s net connection 
- Save resources by caching a copy locally 
 Server side 
- Not all clients use caches 
- Can’t upload unlimited copies of same data from same server 
- Push data out to content distribution network
Caching 
 Many network apps. involve transferring data 
 Goal of caching: Avoid transferring data 
- Store copies of remotely fetched data in caches 
- Avoid re-receiving data you already have 
 Caching concerns keeping copies of data
Examples 
 Web browser caches recently accessed objects 
- E.g., allows “back” button to operate more efficiently 
 Web proxies cache recently accessed URLs 
- Save bandwidth/time when multiple people locally access 
same remote URL 
 DNS resolvers cache resource records 
 Network file systems cache read/written data 
 Laptop caches subset of cloud storage
Cache consistency 
 Problem: What happens when objects change? 
 Is cached copy of data is up to date? 
 Stale data can cause problems 
- E.g., don’t see edits over a network file system 
- Get wrong address for DNS hostname 
- Shopping cart doesn’t contain new items on web store 
 Can have various degrees of consistency
One approach: TTLs 
 Eventual consistency 
 Source controls how long data can be cached 
- Can adjust trade-off: Performance vs. Consistency 
 Example: TTLs in DNS records 
- When looking up vine.best.stanford.edu 
- CNAME record for vine.best.stanford.edu has very short 
TTL—value frequently updated to reflect load averages  
availability 
- NS records for best.stanford.edu has long TTL 
(can’t change quickly, and stanford.edu name servers 
want low load) 
 Example: HTTP reply can include Expires: field
Polling 
 Check with server before using a cached copy 
- Check requires far less bandwidth than downloading object 
 How to know if cache is up to date? 
- Objects can include version numbers 
- Or compare time-last-modified of server  cached copies 
 Example: HTTP If-Modified-Since: request 
 Sun network file system (NFS) 
- Caches file data and attributes 
- To validate data, fetch attributes  compare to cached
Callbacks 
 Polling may cause scalability bottleneck 
- Server must respond to many unnecessary poll requests 
 Example: AFS file system stores software packages 
- Many workstations at university access software on AFS 
- Large, on-disk client caches store copies of software 
- Binary files rarely change 
- Early versions of AFS overloaded server with polling 
 Solution: Server tracks which clients cache which files 
- Sends callback message to each client when data changes
Leases 
 Leases – promise of callback w. expiration time 
- E.g., Download cached copy of file 
- Server says, “For 2 minutes, I’ll let you know if file changes” 
- Or, “You can write file for 2 minutes, I’ll tell you if someone reads” 
- Client can renew lease as necessary 
 What happens if client crashes or network down? 
- Server might need to invalidate client’s cache for update 
- Or might need to tell client to flush dirty file for read 
- Worst case scenario – only need to wait 2 minutes to repair 
 What happens if server crashes? 
- No need to write leases to disk, if rebooting takes 2 minutes 
 Used by Google’s internal naming/lock service (Chubby) 
 Gray, Cheriton won test of time award for leases work 
done here at Stanford
Content Distribution Network (CDN) 
 Network of computers that replicate content across 
the Internet 
 Bringing content closer to requests can improve 
performance 
 All users communicate with Redmond to 
download Microsoft SP 
- Bottleneck: pipes to Redmond 
 Microsoft pushes SP to many hosts around the 
country 
- Uses only local (not shared) capacity 
 Actively pushes data into the network
Why CDNs succeed more 
(compared to web caches) 
 Incentives 
 Content provider (e.g., Microsoft) uses/deploys 
CDN: wants to improve performance and reduce 
costs 
 End user (e.g., network administrator) 
uses/deploys cache: wants to reduce external traffic
Akamai 
 Challenge: static host name needs to point to 
different servers based on location 
 Akamai servers cache content (images, videos, etc.) 
 Uses DNS to direct clients to “close” servers 
 Specifically, points clients to close NS servers 
 Different NS servers provide different host 
lookups
Caches and load balancing 
 Let’s say you are Akamai 
- Clusters of server machines running web caches 
- Caching data from many customers 
- Proxy fetches data from customer’s origin server first time it 
gets request for a URL 
 Choose cluster based on client network location 
 How to choose server within a cluster? 
 Don’t want to chose based on client. . . low hit rate 
- N servers in cluster means N cache misses per URL 
 Also don’t assume proxy servers 100% reliable
Straw man: Modulo hashing 
 Say you have N proxy servers 
 Map requests to proxies as follows: 
- Number servers from 1 to N 
- For URL http://www.server.com/web page.html, 
compute h   HASH(www.server.com00) 
- Redirect clients to proxy # p = h mod N 
 Keep track of load on each proxy 
- If load on proxy # p is too high, with some probability try 
again with different hash function 
 Problem: Most caches will be useless if you 
add/remove proxies, change value of N
Consistent hashing [Karger] 
 Use circular ID space based on circle 
- Consider numbers from 0 to 2160  1 to be points on a circle 
 Use circle to map URLs to proxies: 
- Map each proxy to several randomly-chosen points 
- Map each URL to a point on circle (hash to 160-bit value) 
- To map URL to proxy, just find successor proxy along circle 
 Handles addition/removal of servers much better 
- E.g., for 100 proxies, adding/removing proxy only invalidates 
 1% of cached objects 
- But when proxy overloaded, load spills to successors 
- When proxy leaves, extra misses disproportionately affect 
successors, but will be split among multiple successors 
 Can also handle servers with different capacities 
- Give bigger proxies more random points on circle
Cache Array Routing Protocol (CARP) 
 Different URL! proxy mapping strategy 
- Let list of proxy addresses be p1; p2; : : : pn 
- For URL u, compute: 
h1   HASH(p1; u); h2   HASH(p2; u); : : : 
- Sort h1; : : : hn. If hi is minimum, route request to pi. 
- If hi overloaded, spill over to proxy w. next smallest h 
 Advantages over consistent hashing 
- Spreads load more evenly when server is overloaded, if 
overload is just unfortunate coincidence 
- Spreads additional load more evenly when a proxy dies
Overview 
 How routers handle overload affects how TCP 
(and other protocols) behaves 
 Two router questions: drop policy, scheduling 
policy 
 Can reduce congestion through content 
distribution 
- Clients can cache, need techniques for consistency 
- Services can use a CDN, load-balancing becomes important

More Related Content

What's hot

Tcp(no ip) review part2
Tcp(no ip) review part2Tcp(no ip) review part2
Tcp(no ip) review part2Diptanshu singh
 
Congestion avoidance in TCP
Congestion avoidance in TCPCongestion avoidance in TCP
Congestion avoidance in TCPselvakumar_b1985
 
Congestion control
Congestion controlCongestion control
Congestion controlMadhusudhan G
 
TCP Congestion Control By Owais Jara
TCP Congestion Control By Owais JaraTCP Congestion Control By Owais Jara
TCP Congestion Control By Owais JaraOwaîs Járå
 
Real-Time Streaming Protocol -QOS
Real-Time Streaming Protocol -QOSReal-Time Streaming Protocol -QOS
Real-Time Streaming Protocol -QOSJayaprakash Nagaruru
 
Congestion Control in Computer Networks - ATM and TCP
Congestion Control in Computer Networks - ATM and TCPCongestion Control in Computer Networks - ATM and TCP
Congestion Control in Computer Networks - ATM and TCPAttila Balazs
 
Congestion on computer network
Congestion on computer networkCongestion on computer network
Congestion on computer networkDisi Dc
 
Congestion control
Congestion controlCongestion control
Congestion controlNoushad Hasan
 
Conjestion control
Conjestion controlConjestion control
Conjestion controlBarani Tharan
 
Leaky Bucket & Tocken Bucket - Traffic shaping
Leaky Bucket & Tocken Bucket - Traffic shapingLeaky Bucket & Tocken Bucket - Traffic shaping
Leaky Bucket & Tocken Bucket - Traffic shapingVimal Dewangan
 
Traffic Characterization
Traffic CharacterizationTraffic Characterization
Traffic CharacterizationIsmail Mukiibi
 
Sliding window protocol
Sliding window protocolSliding window protocol
Sliding window protocolRishu Seth
 
Comparison of TCP congestion control mechanisms Tahoe, Newreno and Vegas
Comparison of TCP congestion control mechanisms Tahoe, Newreno and VegasComparison of TCP congestion control mechanisms Tahoe, Newreno and Vegas
Comparison of TCP congestion control mechanisms Tahoe, Newreno and VegasIOSR Journals
 
Xtc Pdiscussionv2
Xtc Pdiscussionv2Xtc Pdiscussionv2
Xtc Pdiscussionv2Tarik KUCUK
 
Tcp performance simulationsusingns2
Tcp performance simulationsusingns2Tcp performance simulationsusingns2
Tcp performance simulationsusingns2Justin Frankel
 
TCP vs UDP / Sumiet23
TCP vs UDP / Sumiet23TCP vs UDP / Sumiet23
TCP vs UDP / Sumiet23Sumiet Talekar
 
Network performance overview
Network  performance overviewNetwork  performance overview
Network performance overviewMy cp
 

What's hot (20)

Analysis of TCP variants
Analysis of TCP variantsAnalysis of TCP variants
Analysis of TCP variants
 
Tcp(no ip) review part2
Tcp(no ip) review part2Tcp(no ip) review part2
Tcp(no ip) review part2
 
Congestion control avoidance
Congestion control avoidanceCongestion control avoidance
Congestion control avoidance
 
Congestion avoidance in TCP
Congestion avoidance in TCPCongestion avoidance in TCP
Congestion avoidance in TCP
 
Congestion control
Congestion controlCongestion control
Congestion control
 
TCP Congestion Control By Owais Jara
TCP Congestion Control By Owais JaraTCP Congestion Control By Owais Jara
TCP Congestion Control By Owais Jara
 
Congestion control and quality of service
Congestion control and quality of serviceCongestion control and quality of service
Congestion control and quality of service
 
Real-Time Streaming Protocol -QOS
Real-Time Streaming Protocol -QOSReal-Time Streaming Protocol -QOS
Real-Time Streaming Protocol -QOS
 
Congestion Control in Computer Networks - ATM and TCP
Congestion Control in Computer Networks - ATM and TCPCongestion Control in Computer Networks - ATM and TCP
Congestion Control in Computer Networks - ATM and TCP
 
Congestion on computer network
Congestion on computer networkCongestion on computer network
Congestion on computer network
 
Congestion control
Congestion controlCongestion control
Congestion control
 
Conjestion control
Conjestion controlConjestion control
Conjestion control
 
Leaky Bucket & Tocken Bucket - Traffic shaping
Leaky Bucket & Tocken Bucket - Traffic shapingLeaky Bucket & Tocken Bucket - Traffic shaping
Leaky Bucket & Tocken Bucket - Traffic shaping
 
Traffic Characterization
Traffic CharacterizationTraffic Characterization
Traffic Characterization
 
Sliding window protocol
Sliding window protocolSliding window protocol
Sliding window protocol
 
Comparison of TCP congestion control mechanisms Tahoe, Newreno and Vegas
Comparison of TCP congestion control mechanisms Tahoe, Newreno and VegasComparison of TCP congestion control mechanisms Tahoe, Newreno and Vegas
Comparison of TCP congestion control mechanisms Tahoe, Newreno and Vegas
 
Xtc Pdiscussionv2
Xtc Pdiscussionv2Xtc Pdiscussionv2
Xtc Pdiscussionv2
 
Tcp performance simulationsusingns2
Tcp performance simulationsusingns2Tcp performance simulationsusingns2
Tcp performance simulationsusingns2
 
TCP vs UDP / Sumiet23
TCP vs UDP / Sumiet23TCP vs UDP / Sumiet23
TCP vs UDP / Sumiet23
 
Network performance overview
Network  performance overviewNetwork  performance overview
Network performance overview
 

Similar to Lecture 12: Queuing, Caching, and CDNs

Computer network (11)
Computer network (11)Computer network (11)
Computer network (11)NYversity
 
05 ergeg mmergm maergergcongergeestion.ppt
05 ergeg mmergm maergergcongergeestion.ppt05 ergeg mmergm maergergcongergeestion.ppt
05 ergeg mmergm maergergcongergeestion.pptTLRTHR
 
05compuernetworkscongestioncontrolalgo.ppt
05compuernetworkscongestioncontrolalgo.ppt05compuernetworkscongestioncontrolalgo.ppt
05compuernetworkscongestioncontrolalgo.pptTLRTHR
 
Computer network (13)
Computer network (13)Computer network (13)
Computer network (13)NYversity
 
Lect9 (1)
Lect9 (1)Lect9 (1)
Lect9 (1)Abdo sayed
 
UAV Data Link Design for Dependable Real-Time Communications
UAV Data Link Design for Dependable Real-Time CommunicationsUAV Data Link Design for Dependable Real-Time Communications
UAV Data Link Design for Dependable Real-Time CommunicationsGerardo Pardo-Castellote
 
Analytical Research of TCP Variants in Terms of Maximum Throughput
Analytical Research of TCP Variants in Terms of Maximum ThroughputAnalytical Research of TCP Variants in Terms of Maximum Throughput
Analytical Research of TCP Variants in Terms of Maximum ThroughputIJLT EMAS
 
Designing TCP-Friendly Window-based Congestion Control
Designing TCP-Friendly Window-based Congestion ControlDesigning TCP-Friendly Window-based Congestion Control
Designing TCP-Friendly Window-based Congestion Controlsoohyunc
 
TCP Theory
TCP TheoryTCP Theory
TCP Theorysoohyunc
 
Mobile Transpot Layer
Mobile Transpot LayerMobile Transpot Layer
Mobile Transpot LayerMaulik Patel
 
TCP Over Wireless
TCP Over WirelessTCP Over Wireless
TCP Over WirelessFarooq Khan
 
Chapter17.ppt
Chapter17.pptChapter17.ppt
Chapter17.pptdeepaMS4
 
QoSintro.PPT
QoSintro.PPTQoSintro.PPT
QoSintro.PPTpayal445263
 
Availability Computer Communication Network .pdf
Availability Computer Communication Network .pdfAvailability Computer Communication Network .pdf
Availability Computer Communication Network .pdfYashShirude1
 
tcp-wireless-tutorial.ppt
tcp-wireless-tutorial.ppttcp-wireless-tutorial.ppt
tcp-wireless-tutorial.pptRadwan Mahmoud
 
Qo s 09-integrated and red
Qo s 09-integrated and redQo s 09-integrated and red
Qo s 09-integrated and redAbhishek Kesharwani
 
integrated and diffrentiated services
 integrated and diffrentiated services integrated and diffrentiated services
integrated and diffrentiated servicesRishabh Gupta
 
2014 IEEE JAVA NETWORKING PROJECT Receiver based flow control for networks in...
2014 IEEE JAVA NETWORKING PROJECT Receiver based flow control for networks in...2014 IEEE JAVA NETWORKING PROJECT Receiver based flow control for networks in...
2014 IEEE JAVA NETWORKING PROJECT Receiver based flow control for networks in...IEEEFINALSEMSTUDENTSPROJECTS
 
IEEE 2014 JAVA NETWORKING PROJECTS Receiver based flow control for networks i...
IEEE 2014 JAVA NETWORKING PROJECTS Receiver based flow control for networks i...IEEE 2014 JAVA NETWORKING PROJECTS Receiver based flow control for networks i...
IEEE 2014 JAVA NETWORKING PROJECTS Receiver based flow control for networks i...IEEEGLOBALSOFTSTUDENTPROJECTS
 

Similar to Lecture 12: Queuing, Caching, and CDNs (20)

Computer network (11)
Computer network (11)Computer network (11)
Computer network (11)
 
05 ergeg mmergm maergergcongergeestion.ppt
05 ergeg mmergm maergergcongergeestion.ppt05 ergeg mmergm maergergcongergeestion.ppt
05 ergeg mmergm maergergcongergeestion.ppt
 
05compuernetworkscongestioncontrolalgo.ppt
05compuernetworkscongestioncontrolalgo.ppt05compuernetworkscongestioncontrolalgo.ppt
05compuernetworkscongestioncontrolalgo.ppt
 
Computer network (13)
Computer network (13)Computer network (13)
Computer network (13)
 
Lect9 (1)
Lect9 (1)Lect9 (1)
Lect9 (1)
 
UAV Data Link Design for Dependable Real-Time Communications
UAV Data Link Design for Dependable Real-Time CommunicationsUAV Data Link Design for Dependable Real-Time Communications
UAV Data Link Design for Dependable Real-Time Communications
 
Analytical Research of TCP Variants in Terms of Maximum Throughput
Analytical Research of TCP Variants in Terms of Maximum ThroughputAnalytical Research of TCP Variants in Terms of Maximum Throughput
Analytical Research of TCP Variants in Terms of Maximum Throughput
 
Designing TCP-Friendly Window-based Congestion Control
Designing TCP-Friendly Window-based Congestion ControlDesigning TCP-Friendly Window-based Congestion Control
Designing TCP-Friendly Window-based Congestion Control
 
TCP Theory
TCP TheoryTCP Theory
TCP Theory
 
Mobile Transpot Layer
Mobile Transpot LayerMobile Transpot Layer
Mobile Transpot Layer
 
Mcseminar
McseminarMcseminar
Mcseminar
 
TCP Over Wireless
TCP Over WirelessTCP Over Wireless
TCP Over Wireless
 
Chapter17.ppt
Chapter17.pptChapter17.ppt
Chapter17.ppt
 
QoSintro.PPT
QoSintro.PPTQoSintro.PPT
QoSintro.PPT
 
Availability Computer Communication Network .pdf
Availability Computer Communication Network .pdfAvailability Computer Communication Network .pdf
Availability Computer Communication Network .pdf
 
tcp-wireless-tutorial.ppt
tcp-wireless-tutorial.ppttcp-wireless-tutorial.ppt
tcp-wireless-tutorial.ppt
 
Qo s 09-integrated and red
Qo s 09-integrated and redQo s 09-integrated and red
Qo s 09-integrated and red
 
integrated and diffrentiated services
 integrated and diffrentiated services integrated and diffrentiated services
integrated and diffrentiated services
 
2014 IEEE JAVA NETWORKING PROJECT Receiver based flow control for networks in...
2014 IEEE JAVA NETWORKING PROJECT Receiver based flow control for networks in...2014 IEEE JAVA NETWORKING PROJECT Receiver based flow control for networks in...
2014 IEEE JAVA NETWORKING PROJECT Receiver based flow control for networks in...
 
IEEE 2014 JAVA NETWORKING PROJECTS Receiver based flow control for networks i...
IEEE 2014 JAVA NETWORKING PROJECTS Receiver based flow control for networks i...IEEE 2014 JAVA NETWORKING PROJECTS Receiver based flow control for networks i...
IEEE 2014 JAVA NETWORKING PROJECTS Receiver based flow control for networks i...
 

More from NYversity

Programming methodology-1.1
Programming methodology-1.1Programming methodology-1.1
Programming methodology-1.1NYversity
 
3016 all-2007-dist
3016 all-2007-dist3016 all-2007-dist
3016 all-2007-distNYversity
 
Programming methodology lecture28
Programming methodology lecture28Programming methodology lecture28
Programming methodology lecture28NYversity
 
Programming methodology lecture27
Programming methodology lecture27Programming methodology lecture27
Programming methodology lecture27NYversity
 
Programming methodology lecture26
Programming methodology lecture26Programming methodology lecture26
Programming methodology lecture26NYversity
 
Programming methodology lecture25
Programming methodology lecture25Programming methodology lecture25
Programming methodology lecture25NYversity
 
Programming methodology lecture24
Programming methodology lecture24Programming methodology lecture24
Programming methodology lecture24NYversity
 
Programming methodology lecture23
Programming methodology lecture23Programming methodology lecture23
Programming methodology lecture23NYversity
 
Programming methodology lecture22
Programming methodology lecture22Programming methodology lecture22
Programming methodology lecture22NYversity
 
Programming methodology lecture20
Programming methodology lecture20Programming methodology lecture20
Programming methodology lecture20NYversity
 
Programming methodology lecture19
Programming methodology lecture19Programming methodology lecture19
Programming methodology lecture19NYversity
 
Programming methodology lecture18
Programming methodology lecture18Programming methodology lecture18
Programming methodology lecture18NYversity
 
Programming methodology lecture17
Programming methodology lecture17Programming methodology lecture17
Programming methodology lecture17NYversity
 
Programming methodology lecture16
Programming methodology lecture16Programming methodology lecture16
Programming methodology lecture16NYversity
 
Programming methodology lecture15
Programming methodology lecture15Programming methodology lecture15
Programming methodology lecture15NYversity
 
Programming methodology lecture14
Programming methodology lecture14Programming methodology lecture14
Programming methodology lecture14NYversity
 
Programming methodology lecture13
Programming methodology lecture13Programming methodology lecture13
Programming methodology lecture13NYversity
 
Programming methodology lecture12
Programming methodology lecture12Programming methodology lecture12
Programming methodology lecture12NYversity
 
Programming methodology lecture11
Programming methodology lecture11Programming methodology lecture11
Programming methodology lecture11NYversity
 
Programming methodology lecture10
Programming methodology lecture10Programming methodology lecture10
Programming methodology lecture10NYversity
 

More from NYversity (20)

Programming methodology-1.1
Programming methodology-1.1Programming methodology-1.1
Programming methodology-1.1
 
3016 all-2007-dist
3016 all-2007-dist3016 all-2007-dist
3016 all-2007-dist
 
Programming methodology lecture28
Programming methodology lecture28Programming methodology lecture28
Programming methodology lecture28
 
Programming methodology lecture27
Programming methodology lecture27Programming methodology lecture27
Programming methodology lecture27
 
Programming methodology lecture26
Programming methodology lecture26Programming methodology lecture26
Programming methodology lecture26
 
Programming methodology lecture25
Programming methodology lecture25Programming methodology lecture25
Programming methodology lecture25
 
Programming methodology lecture24
Programming methodology lecture24Programming methodology lecture24
Programming methodology lecture24
 
Programming methodology lecture23
Programming methodology lecture23Programming methodology lecture23
Programming methodology lecture23
 
Programming methodology lecture22
Programming methodology lecture22Programming methodology lecture22
Programming methodology lecture22
 
Programming methodology lecture20
Programming methodology lecture20Programming methodology lecture20
Programming methodology lecture20
 
Programming methodology lecture19
Programming methodology lecture19Programming methodology lecture19
Programming methodology lecture19
 
Programming methodology lecture18
Programming methodology lecture18Programming methodology lecture18
Programming methodology lecture18
 
Programming methodology lecture17
Programming methodology lecture17Programming methodology lecture17
Programming methodology lecture17
 
Programming methodology lecture16
Programming methodology lecture16Programming methodology lecture16
Programming methodology lecture16
 
Programming methodology lecture15
Programming methodology lecture15Programming methodology lecture15
Programming methodology lecture15
 
Programming methodology lecture14
Programming methodology lecture14Programming methodology lecture14
Programming methodology lecture14
 
Programming methodology lecture13
Programming methodology lecture13Programming methodology lecture13
Programming methodology lecture13
 
Programming methodology lecture12
Programming methodology lecture12Programming methodology lecture12
Programming methodology lecture12
 
Programming methodology lecture11
Programming methodology lecture11Programming methodology lecture11
Programming methodology lecture11
 
Programming methodology lecture10
Programming methodology lecture10Programming methodology lecture10
Programming methodology lecture10
 

Recently uploaded

Science 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsScience 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsKarinaGenton
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxpboyjonauth
 
History Class XII Ch. 3 Kinship, Caste and Class (1).pptx
History Class XII Ch. 3 Kinship, Caste and Class (1).pptxHistory Class XII Ch. 3 Kinship, Caste and Class (1).pptx
History Class XII Ch. 3 Kinship, Caste and Class (1).pptxsocialsciencegdgrohi
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Celine George
 
Biting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfBiting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfadityarao40181
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17Celine George
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Celine George
 
Blooming Together_ Growing a Community Garden Worksheet.docx
Blooming Together_ Growing a Community Garden Worksheet.docxBlooming Together_ Growing a Community Garden Worksheet.docx
Blooming Together_ Growing a Community Garden Worksheet.docxUnboundStockton
 
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxEPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxRaymartEstabillo3
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsanshu789521
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTiammrhaywood
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application ) Sakshi Ghasle
 
Final demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxFinal demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxAvyJaneVismanos
 
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting DataJhengPantaleon
 
Science lesson Moon for 4th quarter lesson
Science lesson Moon for 4th quarter lessonScience lesson Moon for 4th quarter lesson
Science lesson Moon for 4th quarter lessonJericReyAuditor
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentInMediaRes1
 
Pharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfPharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfMahmoud M. Sallam
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxmanuelaromero2013
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️9953056974 Low Rate Call Girls In Saket, Delhi NCR
 

Recently uploaded (20)

Science 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsScience 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its Characteristics
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptx
 
History Class XII Ch. 3 Kinship, Caste and Class (1).pptx
History Class XII Ch. 3 Kinship, Caste and Class (1).pptxHistory Class XII Ch. 3 Kinship, Caste and Class (1).pptx
History Class XII Ch. 3 Kinship, Caste and Class (1).pptx
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17
 
Biting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfBiting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdf
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
 
Blooming Together_ Growing a Community Garden Worksheet.docx
Blooming Together_ Growing a Community Garden Worksheet.docxBlooming Together_ Growing a Community Garden Worksheet.docx
Blooming Together_ Growing a Community Garden Worksheet.docx
 
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxEPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha elections
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application )
 
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
 
Final demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxFinal demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptx
 
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
 
Science lesson Moon for 4th quarter lesson
Science lesson Moon for 4th quarter lessonScience lesson Moon for 4th quarter lesson
Science lesson Moon for 4th quarter lesson
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media Component
 
Pharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfPharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdf
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptx
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
 

Lecture 12: Queuing, Caching, and CDNs

  • 1. Lecture 12: Queuing, Caching, and Content Distribution
  • 2. Overview How routers queue affects how TCP and other protocols behave Two router questions: drop policy, scheduling policy Reducing congestion through content distribution - Clients can cache - Services can use a CDN
  • 3. Congestion Control Revisited Congestion is when the input rate output rate - In TCP, flow control window ensures sender does not exceed rate at which receiver consumes data - What if senders exceed a router’s maximum output rate? What should routers do? Make sender slow down TCP sending rate = window-size=RTT, so 2 options: 1. Increase RTT – buffer more packets =)more queuing delay 2. Reduce window size – happens if router drops packets Recall TCP reacts to packet loss by shrinking congestion window - Triple duplicate ack: halve window, enter CA state - Timeout: set window to 1, enter SS state
  • 4. Congestion at Router Destination 1.5-Mbps T1 link Router Source 1 Source 2 10-Mbps Ethernet 100-Mbps FDDI Router goals - Prioritize who gets limited resources - Somehow interact well with TCP
  • 5. Router design issues Scheduling discipline - Which of multiple packets should you send next? - May want to achieve some notion of fairness - May want some packets to have priority Drop policy - When should you discard a packet? - Which packet to discard? - Some packets more important (perhaps BGP) - Some packets useless w/o others (IP fragments) Need to balance throughput delay - Could minimize/eliminate drops with enormous buffers - But queuing delay highly frowned upon (interactive apps)
  • 6. Example: FIFO tail drop Arriving packet Next free buffer Next to transmit Free buffers Queued packets (a) Arriving packet Next to transmit (b) Drop Differentiates packets only by when they arrive - Packet dropped if queue full when it arrives
  • 7. Tail drop issues When stable, queue will always be nearly full - Guarantees high latency for all traffic Possibly unfair for flows with small windows - E.g., small flow ( 4 segments) may be stuck in backoff, while larger flows can use fast retransmit to recover Window synchronization - Consider many flows in a stable configuration - New flow comes in, causes a bunch of packet losses - Existing flows all cut their windows together (underutilizing link) - Flows all grow their windows together until link again overloaded and many packets lost. Repeat. . .
  • 8. What to optimize for? Fairness (in two slides) High throughput – queue should never be empty Low delay – so want short queues Crude combination: power = Throughput=Delay - Want to convince hosts to offer optimal load Optimal load Load Throughput/delay
  • 9. Connectionless flows Router Source 1 Source 2 Source 3 Router Router Destination 1 Destination 2 Even in Internet, routers can have a notion of flows - E.g., base on IP addresses TCP ports (or hash of those) - Soft state—doesn’t have to be correct - But if often correct, can use to form router policies
  • 10. Fairness What is fair in this situation? - Each flow gets 1=2 link b/w? Long flow gets less? Usually fair means equal - For flow bandwidths (x1; : : : ; xn), fairness index: f(x1; : : : ; xn) = ( Pn i=1 xi)2 n Pn i=1 x2i - If all xis are equal, fairness is one - Weighted fairness is a simple extension So what policy should routers follow?
  • 11. Scheduling Policy: Fair Queuing (FQ) Explicitly segregates traffic based on flows Ensures no flow consumes more than its share - Variation: weighted fair queuing (WFQ) Note: if all packets were same length, would be easy Flow 1 Flow 2 Flow 3 Flow 4 Round-robin service
  • 12. Fair Queuing Basics Keep track of how much time each flow has used link Compute how long a flow will have used link if it transmits next packet Send packet from flow which will have lowest use if it transmits - Why not flow with smallest use so far? - Because next packet may be huge (examples coming)
  • 13. FQ Algorithm Suppose clock ticks each time a bit is transmitted Pi: length of packet i Si: time when packet i started transmission Fi: time when packet i finished transmission Fi = Si + Pi When does router start transmitting packet i? - If arrived before router finished packet i 1 from this flow, then immediately after last bit of i 1 (Fi1) - If no current packets for this flow, then start transmitting when arrives (call this Ai) Thus: Fi = max(Fi1;Ai) + Pi
  • 14. FQ Algorithm (cont) For multiple flows - Calculate Fi for each packet that arrives on each flow - Treat all Fis as timestamps - Next packet to transmit is one with lowest timestamp Not perfect: can’t preempt current packet Example: Flow 1 Flow 2 Flow 1 (arriving) Output Output (a) (b) F = 8 F = 10 F = 5 F = 10 F = 2 Flow 2 (transmitting)
  • 15. FQ Algorithm (cont) One complication: inactive flows are penalized (Ai Fi1) Over what interval do you consider fairness? - Standard algorithm considers no history - Each flow gets fair share while packets queued Solution: Bi = Pi + max(Fi1;Ai ) = interval of history to consider
  • 16. Fair Queueing Importance “Our packet-by-packet transmission algorithm is simply defined by the rule that, whenever a packet finishes transmission, the next packet is the one with the smallest F i .” But, fair queueing not used in core routers: finding min F in hundreds of thousands of flows is expensive. Can be used on edge routers and low speed links.
  • 17. Drop Policy: Random Early Detection (RED) Notification of congestion is implicit in Internet - Just drop the packet (TCP will timeout) - Could make explicit by marking the packet (ECN extension to IP allows routers to mark packets) Early random drop - Don’t wait for full queue to drop packet - Instead, drop packets with some drop probability whenever the queue length exceeds some drop level - Prevents global window synchronization: many TCP flows speed up, all have packets dropped, all slow down, etc.
  • 18. RED Details Compute average queue length - AvgLen = (1 Weight) AvgLen +Weight SampleLen - 0 Weight 1 (usually 0.002) SampleLen is queue length each time a packet arrives MaxThreshold MinThreshold AvgLen
  • 19. AvgLen Queue length Instantaneous Average Time Smooths out AvgLen over time - Don’t want to react to instantaneous fluctuations
  • 20. RED Details (cont) Two queue length thresholds: if AvgLen = MinThreshold then enqueue the packet if MinThreshold AvgLen MaxThreshold then calculate probability P drop arriving packet with probability P if MaxThreshold = AvgLen then drop arriving packet
  • 21. RED Details (cont) Computing probability P - Pb = MaxP (AvgLenMinThreshold) (MaxThresholdMinThreshold) P(drop) 1.0 MaxP MinThresh MaxThresh AvgLen Actual drop probability based on time since last drop - count = # pkts since drop or MinThresh Avglen MaxThresh - P = Pb=(1 count Pb) - Space out drops, separate when to drop from which to drop
  • 22. What P looks like 1 0.8 Pb=0.05 Pb=0.01 drop of 0.6 Probability 0.4 0.2 0 Count since last drop 0 10 20 30 40 50 60 70 80 90
  • 23. Tuning RED - Probability of dropping a particular flow’s packet(s) is roughly proportional to the share of the bandwidth that flow is currently getting - MaxP is typically set to 0.02 - If traffic is bursty, then MinThreshold should be sufficiently large to allow link utilization to be maintained at an acceptably high level - Difference between two thresholds should be larger than the typical increase in the calculated average queue length in one RTT; setting MaxThreshold to twice MinThreshold is reasonable for traffic on today’s Internet
  • 24. Queueing Today Cisco IOS - Scheduling: FIFO, FQ, WFQ, Custom queueing (patterns) - Drop policy: Tail drop, weighted random early detection The buffer bloat problem (DSL/Cable modems, WiFi drivers, etc.)
  • 26. Content distribution How can end nodes reduce load on bottleneck links? - Congestion makes net slower – nobody wants this Client side - Many people from Stanford might access same web page - Redundant downloads a bad use of Stanford’s net connection - Save resources by caching a copy locally Server side - Not all clients use caches - Can’t upload unlimited copies of same data from same server - Push data out to content distribution network
  • 27. Caching Many network apps. involve transferring data Goal of caching: Avoid transferring data - Store copies of remotely fetched data in caches - Avoid re-receiving data you already have Caching concerns keeping copies of data
  • 28. Examples Web browser caches recently accessed objects - E.g., allows “back” button to operate more efficiently Web proxies cache recently accessed URLs - Save bandwidth/time when multiple people locally access same remote URL DNS resolvers cache resource records Network file systems cache read/written data Laptop caches subset of cloud storage
  • 29. Cache consistency Problem: What happens when objects change? Is cached copy of data is up to date? Stale data can cause problems - E.g., don’t see edits over a network file system - Get wrong address for DNS hostname - Shopping cart doesn’t contain new items on web store Can have various degrees of consistency
  • 30. One approach: TTLs Eventual consistency Source controls how long data can be cached - Can adjust trade-off: Performance vs. Consistency Example: TTLs in DNS records - When looking up vine.best.stanford.edu - CNAME record for vine.best.stanford.edu has very short TTL—value frequently updated to reflect load averages availability - NS records for best.stanford.edu has long TTL (can’t change quickly, and stanford.edu name servers want low load) Example: HTTP reply can include Expires: field
  • 31. Polling Check with server before using a cached copy - Check requires far less bandwidth than downloading object How to know if cache is up to date? - Objects can include version numbers - Or compare time-last-modified of server cached copies Example: HTTP If-Modified-Since: request Sun network file system (NFS) - Caches file data and attributes - To validate data, fetch attributes compare to cached
  • 32. Callbacks Polling may cause scalability bottleneck - Server must respond to many unnecessary poll requests Example: AFS file system stores software packages - Many workstations at university access software on AFS - Large, on-disk client caches store copies of software - Binary files rarely change - Early versions of AFS overloaded server with polling Solution: Server tracks which clients cache which files - Sends callback message to each client when data changes
  • 33. Leases Leases – promise of callback w. expiration time - E.g., Download cached copy of file - Server says, “For 2 minutes, I’ll let you know if file changes” - Or, “You can write file for 2 minutes, I’ll tell you if someone reads” - Client can renew lease as necessary What happens if client crashes or network down? - Server might need to invalidate client’s cache for update - Or might need to tell client to flush dirty file for read - Worst case scenario – only need to wait 2 minutes to repair What happens if server crashes? - No need to write leases to disk, if rebooting takes 2 minutes Used by Google’s internal naming/lock service (Chubby) Gray, Cheriton won test of time award for leases work done here at Stanford
  • 34. Content Distribution Network (CDN) Network of computers that replicate content across the Internet Bringing content closer to requests can improve performance All users communicate with Redmond to download Microsoft SP - Bottleneck: pipes to Redmond Microsoft pushes SP to many hosts around the country - Uses only local (not shared) capacity Actively pushes data into the network
  • 35. Why CDNs succeed more (compared to web caches) Incentives Content provider (e.g., Microsoft) uses/deploys CDN: wants to improve performance and reduce costs End user (e.g., network administrator) uses/deploys cache: wants to reduce external traffic
  • 36. Akamai Challenge: static host name needs to point to different servers based on location Akamai servers cache content (images, videos, etc.) Uses DNS to direct clients to “close” servers Specifically, points clients to close NS servers Different NS servers provide different host lookups
  • 37. Caches and load balancing Let’s say you are Akamai - Clusters of server machines running web caches - Caching data from many customers - Proxy fetches data from customer’s origin server first time it gets request for a URL Choose cluster based on client network location How to choose server within a cluster? Don’t want to chose based on client. . . low hit rate - N servers in cluster means N cache misses per URL Also don’t assume proxy servers 100% reliable
  • 38. Straw man: Modulo hashing Say you have N proxy servers Map requests to proxies as follows: - Number servers from 1 to N - For URL http://www.server.com/web page.html, compute h HASH(www.server.com00) - Redirect clients to proxy # p = h mod N Keep track of load on each proxy - If load on proxy # p is too high, with some probability try again with different hash function Problem: Most caches will be useless if you add/remove proxies, change value of N
  • 39. Consistent hashing [Karger] Use circular ID space based on circle - Consider numbers from 0 to 2160 1 to be points on a circle Use circle to map URLs to proxies: - Map each proxy to several randomly-chosen points - Map each URL to a point on circle (hash to 160-bit value) - To map URL to proxy, just find successor proxy along circle Handles addition/removal of servers much better - E.g., for 100 proxies, adding/removing proxy only invalidates 1% of cached objects - But when proxy overloaded, load spills to successors - When proxy leaves, extra misses disproportionately affect successors, but will be split among multiple successors Can also handle servers with different capacities - Give bigger proxies more random points on circle
  • 40. Cache Array Routing Protocol (CARP) Different URL! proxy mapping strategy - Let list of proxy addresses be p1; p2; : : : pn - For URL u, compute: h1 HASH(p1; u); h2 HASH(p2; u); : : : - Sort h1; : : : hn. If hi is minimum, route request to pi. - If hi overloaded, spill over to proxy w. next smallest h Advantages over consistent hashing - Spreads load more evenly when server is overloaded, if overload is just unfortunate coincidence - Spreads additional load more evenly when a proxy dies
  • 41. Overview How routers handle overload affects how TCP (and other protocols) behaves Two router questions: drop policy, scheduling policy Can reduce congestion through content distribution - Clients can cache, need techniques for consistency - Services can use a CDN, load-balancing becomes important