Computer Networks CDN and Dns
Computer Networks CDN and Dns
Computer Networks CDN and Dns
1
Question on differences between
connection and circuit
• Connection
A transport layer concept
Resources are reserved at end hosts (sender & receiver)
Need the underlying network layer to send data
• Circuit
A network layer concept
Resources are reserved at each hop
Circuit switching is one way to support a connection;
packet switching is the other way
2
Agenda
• CDN: Content Distribution Network
• DNS: Domain Name System
3
Recap:
Improving HTTP performance
• Optimizing connections using three “P”s
Persistent connections
Parallel/concurrent connections
Pipelined transfers over the same connection
4
Caching
• Why does caching work?
Exploit locality of reference
5
Caching: How
• Modifier to GET requests:
If-modified-since – returns “not modified” if
resource not modified since specified time
6
Caching: How
• Modifier to GET requests:
If-modified-since – returns “not modified” if
resource not modified since specified time
• Client specifies “if-modified-since” time in
request
• Server compares this against “last
modified” time of resource
• Server returns “Not Modified” if resource
has not changed
• …. or a “OK” with the latest version
otherwise
7
Caching: How
• Modifier to GET requests:
If-modified-since – returns “not modified” if
resource not modified since specified time
• Response header:
Expires – how long it’s safe to cache the resource
No-cache – ignore all caches; always get resource
directly from server
8
Caching: Where?
• Options
Client (browser)
Forward proxies
Reverse proxies
Content Distribution Network
9
Caching: Where?
• Many clients transfer same information
Generate unnecessary server and network load
Clients experience unnecessary latency
Server
Tier-1 ISP
ISP-1 ISP-2
Clients
10
Caching with Reverse Proxies
• Cache documents close to server
Decrease server load
By content provider
Reverse proxies
Tier-1 ISP
ISP-1 ISP-2
Clients
11
Caching with Forward Proxies
• Cache documents close to clients
Reduce network traffic and decrease latency
By ISPs or enterprises
Reverse proxies
Tier-1 ISP
Forward proxies
ISP-1 ISP-2
Clients
12
Replication
• Replicate popular Websites across many machines
Spread load across servers
Place content closer to clients
Help when content isn’t cacheable
13
Content Distribution Networks
(CDN)
• Caching and replication as a service
• Large-scale distributed storage infrastructure
(usually) administered by one entity
e.g., Akamai has servers in 20,000+ locations
• Combination of caching and replication
Pull: Direct result of clients’requests (caching)
Push: Expectation of high access rate (replication)
• Can do some processing to handle dynamic
webpage content
14
CDN example – Akamai
• Akamai creates new domain names for each client
e.g., a128.g.akamai.net for cnn.com
• The client content provider modifies content so
that embedded URLs reference new domains
“Akamaize” content
e.g., http://www.cnn.com/image-of-the-day.gif becomes
http://a128.g.akamai.net/image-of-the-day.gif
• Requests now sent to CDN’s infrastructure
15
How to direct clients to particular
replicas?
• In order to
Balancing load across server replicas
Pairing clients with nearby servers to decrease latency
and overall bandwidth usage
16
DNS
18
Why?
• Convenience
Easier to remember www.google.com than
216.58.216.100
19
Goals
• Uniqueness: no naming conflicts
• Scalable
Many names and frequent updates
• Distributed, autonomous administration
Ability to update my own (machines’) names
Don’t have to track everybody’s updates
• Highly available
• Lookups are fast
• Perfect consistency is a non-goal
20
How?
• Partition the namespace
• Distribute administration of each partition
Autonomy to update my own (machines’) names
Don’t have to track everybody’s updates
• Distribute name resolution for each partition
• How should we partition things?
21
Key idea: Hierarchy
• Three intertwined hierarchies
Hierarchical namespace
• As opposed to original flat namespace
Hierarchically administered
• As opposed to centralized
(Distributed) hierarchy of servers
• As opposed to centralized storage
22
Key idea: Hierarchy
$ sftp subidh
subidh
10.5.20.4
23
DNS Hierarchy
root
www
facebook
DNS Type
14.139.54.198
8.8.8.8
iitbhilai.ac.in
Delegation: A name server may not have a zone but may iisc.ac.in
have the link of another nameserver who has the zone 29
Zones
The Resolution Process
• Let’s look at the resolution process step-by-step:
Debobroto’s machine
ping www.facebook.com.
TCP Layer Vulenrabilities 30
The Resolution Process
Resolver
Debobroto’s machine
ping www.facebook.com.
TCP Layer Vulenrabilities 31
The Resolution Process
m.root-servers.net
Resolver
Debobroto’s machine
ping www.facebook.com.
TCP Layer Vulenrabilities 32
The Resolution Process
• The root server m refers DNS to the com name servers
• This type of response is called a “referral”
m.root-servers.net
Resolver
Here’s a list of the
com name servers.
Ask one of them.
Debobroto’s machine
ping www.facebook.com.
TCP Layer Vulenrabilities 33
The Resolution Process
m.root-servers.net
Resolver
f.gtld-servers.net
Debobroto’s machine
ping www.facebook.com.
TCP Layer Vulenrabilities 34
The Resolution Process
f.gtld-servers.net
Debobroto’s machine
ping www.facebook.com.
TCP Layer Vulenrabilities 35
The Resolution Process
m.root-servers.net
Resolver
ns1.sanjose.facebook.net
f.gtld-servers.net
Debobroto’s machine
ping www.facebook.com.
TCP Layer Vulenrabilities 36
The Resolution Process
m.root-servers.net
Resolver
Debobroto’s machine
ping www.facebook.com.
TCP Layer Vulenrabilities 37
The Resolution Process
• The name server DNS responds to Debobroto
with www.facebook.com’s address
Here’s the IP
address for
www.facebook.com
m.root-servers.net
Resolver
ns1.sanjose.facebook.net
f.gtld-servers.net
Debobroto’s machine
ping www.facebook.com.
TCP Layer Vulenrabilities 38
Resolution Process
(Caching)
• After the previous query, the name server DNS now knows:
The names and IP addresses of the com name servers
The names and IP addresses of the facebook.com name
servers
The IP address of www.facebook.com
• Let’s look at the resolution process again
Debobroto’s machine
ping ftp.facebook.com.
TCP Layer Vulenrabilities 39
Resolution Process
(Caching)
m.root-servers.net
Resolver
f.gtld-servers.net
Debobroto’s machine
ping www.facebook.com.
TCP Layer Vulenrabilities 40
Resolution Process
(Caching)
• DNS has cached a NS record indicating ns1.sanjose is an
facebook.com name server, so it asks it for
ftp.facebook.com’s address
What’s the IP address
of ftp.facebook.com?
m.root-servers.net
Resolver
ns1.sanjose.facebook.net
f.gtld-servers.net
Debobroto’s machine
ping ftp.facebook.com.
TCP Layer Vulenrabilities 41
Resolution Process
(Caching)
• The facebook.com name server ns1.sanjose
responds with ftp.facebook.com’s address
DNS responses are cached
Here’s the IP
address for ns1.sanjose.facebook.net
ftp.facebook.com
f.gtld-servers.net
Debobroto’s machine
ping ftp.facebook.com.
TCP Layer Vulenrabilities 42
DNS Packet
• Query ID:
16 bit random value
Links response to query
Response ignored if
unrecognized QueryID
46
Inserting Resource Records into
DNS
• Register foobar.com at registrar (GoDaddy)
Provide registrar with names and IP addresses of your
authoritative name server(s)
Registrar inserts RR pairs into the .com TLD server:
• (foobar.com, dns1.foobar.com, NS)
• (dns1.foobar.com, 212.44.9.129, A)
• Store resource records in your server
dns1.foobar.com
e.g., type A record for www.foobar.com
e.g., type MX record for foobar.com
47
Two ways to resolve a name
• Recursive name resolution
Ask server to do it for you
• Iterative name resolution
Ask server who to ask next
• The iterative example we saw is a mix of both!
48
Reliability
• Replicated DNS servers (primary/secondary)
Name service available if at least one replica is up
Queries can be load-balanced between replicas
• Usually, UDP used for queries
Reliability, if needed, must be implemented on UDP
• Try alternate servers on timeout
Exponential backoff when retrying same server
• Same identifier for all queries
Don’t care which server responds
49
Thanks!
Q&A
50