1 of 42

Discussion 8

1

CS 168, Spring 2026 @ UC Berkeley

Slides credit: Sylvia Ratnasamy, Rob Shakir, Peyrin Kao, Iuniana Oprescu

DNS, HTTP 📨

2 of 42

Logistics

  • Midterm this Friday, March 20, 7-9pm
  • Project 3A: Transport
    • Deadline: Friday, April 3

3 of 42

Domain Name System

  • DNS Caching
  • Anatomy of a URL

4 of 42

Typical DNS Query

Client

Resolving server

.org servers

.wikipedia.org servers

Where is www.wikipedia.org?

Where is www.wikipedia.org?

Where is www.wikipedia.org?

Where is www.wikipedia.org?�(recursive)

Ask .org server at 1.2.3.4

Ask wikipedia.org server at 5.6.7.8

Answer: 9.10.11.12

root servers

5 of 42

Caching DNS Responses

  • DNS responses cached in DNS resolvers
    • Expire after TTL (time-to-live)
  • Most popular sites visited often
    • Top sites frequently cached. Fast!

IP: Z

www.google.com

DNS server

(mydns.berkeley.edu)

DNS client�(me.cs.berkeley.edu)

Hostname

IP

TTL

www.google.com

Z

60 min

6 of 42

Anatomy of a URL

Scheme

Usually a protocol like (http, ftp, https, smtp, rtsp, etc.)

host

DNS hostname or an IP address

port

Defaults to protocol’s standard port�e.g. http: 80 https: 443

path

Traditionally reflects the file system

resource

Identifies the desired resource

Can also extend to program executions:

http://us.f413.mail.yahoo.com/ym/ShowLetter?box=%40B%40Bulk&MsgId=2604_1744106_29699_1123_1261_0_28917_3552_1289957100&Search=&Nhead=f&YY=31454&order=down&sort=date&pos=0&view=a&head=b

scheme://host[:port]/path/resource

7 of 42

HTTP

  • HTTP
  • CDN Caching
  • Sending Ethernet Packets

8 of 42

HTTP

  • Client-server architecture
    • Server is “always on” and “well known”
    • Clients initiate contact to server
  • Synchronous request/reply protocol
    • “Synchronous” means same HTTP session used for request and reply
    • Runs over TCP, Port 80

9 of 42

Requests and Responses

Response

HTTP/1.1 200 OK

Connection close

Date: Thu, 06 Aug 2006 12:00:15 GMT

Server: Apache/1.3.0 (Unix)

Last-Modified: Mon, 22 Jun 2006 ...

Content-Length: 6821

Content-Type: text/html

(blank line)

data data data data data ...

Request

GET /somedir/page.html HTTP/1.1

Host: www.someschool.edu

User-agent: Mozilla/4.0

Connection: close

Accept-language: fr

(blank line)

10 of 42

Performance!

  • A wise person once said “Architect for flexibility, engineer for performance”
  • We have an architected solution – let’s explore ways to make it go fast

11 of 42

Request Patterns

SYN

SYN + ACK

ACK + R1

T1

Concurrent

Pipelined

Persistent

ACK

R2

T2

12 of 42

Caching: How

  • Idea: Replication
    • Replicate the content across multiple copies to reduce bottlenecks
  • Implementation: content delivery networks (CDNs)
    • The client content provider modifies its content so that embedded URLs reference the new domains.
    • e.g.: http://www.netflix.com/tiger_king.jpg might become http://a1386.g.akamai.net/tiger_king.jpg

13 of 42

Caching: CNAMEs

  • Instead of using a weird URL, use CNAMEs!
    • List picture as http://cdn.netflix.com/tiger_king.jpg
    • The authoritative server for this is controlled by netflix
    • CNAME record aliases cdn.netflix.com to a1386.g.akamai.net
  • Akamai handles sending to the closest server because a1386.g.akamai.net is under an Akamai nameserver

  • Only change to the HTML is http://www.netflix.com/tiger_king.jpg became http://cdn.netflix.com/tiger_king.jpg

14 of 42

Caching: Specifics in HTTP

  • GET Request header:
    • If-Modified-Since – returns “not modified” if resource not modified since specified time
    • Cache-Control: no-cache – ignore all caches; always get resource directly from server (think force refresh)
  • Response header:
    • Cache -Control: max-age=<ttl> – TTL: how long to cache the resource
    • Cache-Control: no-store – Don’t cache this
  • When making request, if within the TTL, just load cached resource… otherwise, send with if-modified.
    • Server will either send a HTTP 304 (“Not Modified”) or HTTP 200 (changed, and here’s the new data)

15 of 42

Caching: Where

  • Forward Proxies
    • Cache near the client
  • Reverse Proxies
    • Reduce server load

16 of 42

Worksheet

  • True/False
  • Domain Name System
  • Performance
  • HTTP

17 of 42

Question 1: True/False

18 of 42

Worksheet

  • True/False
  • Domain Name System
  • Performance
  • HTTP

19 of 42

Question 2: Domain Name System

20 of 42

Question 2: Domain Name System

21 of 42

Question 2: Domain Name System

22 of 42

Worksheet

  • True/False
  • Domain Name System
  • Performance
  • HTTP

23 of 42

Question 3: Performance

24 of 42

Question 3: Performance

25 of 42

Question 3: Performance

26 of 42

Question 3: Performance

27 of 42

Question 3: Performance

28 of 42

Question 3: Performance

29 of 42

Question 3: Performance

30 of 42

Question 3: Performance

31 of 42

Question 3: Performance

32 of 42

Worksheet

  • True/False
  • Domain Name System
  • Performance
  • HTTP

33 of 42

Question 4: HTTP

34 of 42

Question 4: HTTP

35 of 42

Question 4: HTTP

36 of 42

Question 4: HTTP

37 of 42

Question 4: HTTP

38 of 42

Question 4: HTTP

39 of 42

Question 4: HTTP

40 of 42

Question 4: HTTP

41 of 42

Question 4: HTTP

42 of 42

Questions?

Feedback Form: https://tinyurl.com/cs168-su25-disc-feedback