1 of 19

CS118 Dis 1EF, Week 2

Xinyu Ma

2 of 19

Contents

  • More examples of HTTP
    • Did some last week
  • DNS
  • Quiz 1
  • TCP programming by LA

2

3 of 19

About Participation Grade

  • The Goodhart’s law:
    • “When a measure becomes a target, it ceases to be a good measure”
  • Are you participating in (any of, to any degree):
    • Lecture
    • Discussion
    • Piazza
    • Office Hours
  • If any of us (Professor Zhang, Tianyuan, Xinyu, Paul, Omar) can point to your name on a roster and say, “yeah, we know them”—you’ve got nothing to worry about.
  • No tracker for discussion attendance, so feel free to swap to another session if time conflict.

3

4 of 19

HTTP 1.0 vs 1.1

Copied from old lecture

4

5 of 19

HTTP 1.0 vs 1.1

  • RTT is a property of network:
    • The time it takes for a small packet to travel from client to server and then back to the client.
    • ≈ Sum of non-transmission delays on the round-trip path
    • Irrelevant of what you transmit
  • Time to fetch a file in an open connection = 1 RTT + Transmission time (bottleneck)
  • FYI: However, since RTT includes queuing delay, it is not a fixed number in real world.

5

6 of 19

CDN Case 1

  • Exploit DNS to direct your connection to a nearby CDN server
  • Examples:
    • www.ucla.edu. 60 IN CNAME d1zev4mn1zpfbc.cloudfront.net.
    • d2qnx9mnmqbxo6.cloudfront.net. 60 IN A 18.154.132.13

6

7 of 19

CDN Case 1

  • CloudFront is Amazon’s CDN cache service
  • Serve the file directly until is expires
  • After the expiration, use conditional GET to check with the original web server.
  • CloudFront also has its own setting for caching.
  • Browser requested the CDN node at 21:26:23
  • The CDN node got the file at 20:50:58
  • The content expired at 22:50:58
  • The content could stay in any cache for at most 2 hours.

7

age: 2185

cache-control: public

content-encoding: gzip

content-length: 16495

date: Fri, 14 Apr 2023 03:50:58 GMT

set-cookie: expires=Fri, 14-Apr-2023 05:50:58 GMT; Max-Age=7200;

8 of 19

CDN Case 2

8

9 of 19

HOL blocking

  • Imagine a web page has a very large background image bg.png and several embedded images 1.png, …, 10.png
  • The browser sends requests in the order of: bg.png, 1.png, …, 10.png
  • HTTP/1.1 server has to responds in the order of requests: bg.png, 1.png, …, 10.png
    • The page does not show anything for a long time
  • HTTP/2.0 server could push the files before the requests come
    • Also, fulfill the requests in arbitrary order.
    • The page loads without bg.png for a short time.

9

10 of 19

DNS

  • Hierarchical name space
  • Scalability design:
    • Decentralized database
    • Caching
  • Availability design
    • Redundancy
    • Caching
  • Note that name assignment is decentralized

10

11 of 19

DNS

  • DIG experiment
    • dig .
    • dig a.root-servers.net
    • dig edu @198.41.0.4 (a.root-servers.net.)
    • dig ucla.edu @2001:503:231d::2:30 (b.edu-servers.net.)
    • dig www.ucla.edu @2607:f010:3fe:12:0:ff:fe01:35 (ns1.dns.ucla.edu.)
  • At last I get CNAME d2qnx9mnmqbxo6.cloudfront.net.
    • That’s how UCLA makes use of CDN

11

12 of 19

DNS Problem

  • All caches are empty
  • TTL values for all records is 1 hour
  • RTT between stub resolvers (A,B,C) and the caching resolver is 20 ms
  • RTT between the caching resolver and any of the authoritative name servers is 150 ms
  • No packet losses
  • No processing delays
  • Every organization maintains their own servers. No CNAME aliases used here.
  • T=0min, A sends a request for aws.amazon.com, and then for www.amazon.com. How long did it take?

12

13 of 19

DNS Problem

  • All caches are empty
  • TTL values for all records is 1 hour
  • RTT between stub resolvers (A,B,C) and the caching resolver is 20 ms
  • RTT between the caching resolver and any of the authoritative name servers is 150 ms
  • No packet losses
  • No processing delays
  • Every organization maintains their own servers. No CNAME aliases used here.
  • T=0min, A sends a request for aws.amazon.com, and then for www.amazon.com. How long did it take?
  • aws.amazon.com: 150x3+20
  • www.amazon.com: 150x1+20
  • Total: 640ms

13

14 of 19

DNS Problem

  • All caches are empty
  • TTL values for all records is 1 hour
  • RTT between stub resolvers (A,B,C) and the caching resolver is 20 ms
  • RTT between the caching resolver and any of the authoritative name servers is 150 ms
  • No packet losses
  • No processing delays
  • Every organization maintains their own servers. No CNAME aliases used here.
  • T=0min, A sends a request for aws.amazon.com, and then for www.amazon.com. How long did it take?
  • T=40min, B queries MX for google.com and returns:

How long does it take?

14

15 of 19

DNS Problem

  • All caches are empty
  • TTL values for all records is 1 hour
  • RTT between stub resolvers (A,B,C) and the caching resolver is 20 ms
  • RTT between the caching resolver and any of the authoritative name servers is 150 ms
  • No packet losses
  • No processing delays
  • Every organization maintains their own servers. No CNAME aliases used here.
  • T=0min, A sends a request for aws.amazon.com, and then for www.amazon.com. How long did it take?
  • T=40min, B queries MX for google.com and returns:

How long does it take?

  • 20+150x2 = 320ms

15

16 of 19

DNS Problem

  • All caches are empty
  • TTL values for all records is 1 hour
  • RTT between stub resolvers (A,B,C) and the caching resolver is 20 ms
  • RTT between the caching resolver and any of the authoritative name servers is 150 ms
  • No packet losses
  • No processing delays
  • Every organization maintains their own servers. No CNAME aliases used here.
  • T=0min,A queries www.amazon.com
  • T=40min, B queries MX for google.com
  • T=70min, C queries AAAA for mail.google.com; T=75min, C queries AAAA for meet.google.com. How long does each take?

16

17 of 19

DNS Problem

  • All caches are empty
  • TTL values for all records is 1 hour
  • RTT between stub resolvers (A,B,C) and the caching resolver is 20 ms
  • RTT between the caching resolver and any of the authoritative name servers is 150 ms
  • No packet losses
  • No processing delays
  • Every organization maintains their own servers. No CNAME aliases used here.
  • T=0min,A queries www.amazon.com
  • T=40min, B queries MX for google.com
  • T=70min, C queries AAAA for mail.google.com; T=75min, C queries AAAA for meet.google.com. How long does each take?
  • 20+150x1 = 170ms
  • Note: Query for AAAA does not mean it has to connect to an IPv6 DNS server!

17

18 of 19

DNS Problem

  • All caches are empty
  • TTL values for all records is 1 hour
  • RTT between stub resolvers (A,B,C) and the caching resolver is 20 ms
  • RTT between the caching resolver and any of the authoritative name servers is 150 ms
  • No packet losses
  • No processing delays
  • Every organization maintains their own servers. No CNAME aliases used here.
  • T=0min,A queries www.amazon.com
  • T=40min, B queries MX for google.com
  • T=70min, C queries mail.google.com
  • T=75min, C queries meet.google.com
  • T=90min, all entries in the caching resolver:
    • google.com/NS
    • google.com/MX (x2)
    • primary.google.com/A
    • backup.google.com/A
    • mail.google.com/AAAA
    • meet.google.com/AAAA

18

19 of 19

Quiz

  • The Internet delivers bags of bits, but “a bag of bits” is called with different names at different layers.
    • The reality is the word “packet” is abused everywhere
  • Transport Layer (namely TCP and TCP-like protocols): Segment
  • Network Layer: Packets (IP packets are also called IP datagrams)
  • Link layer: Frames

19