lecture23-dns-hakimHowever, Internet routes and forwards requests based on IP addresses Need to...

71
Computer Networks: Architecture and Protocols CS4450 Lecture 23 DNS and HTTP

Transcript of lecture23-dns-hakimHowever, Internet routes and forwards requests based on IP addresses Need to...

Page 1: lecture23-dns-hakimHowever, Internet routes and forwards requests based on IP addresses Need to convert name (e.g., ) to an IP address Domain Name System (DNS) Provides the mapping

ComputerNetworks:ArchitectureandProtocols

CS4450

Lecture23DNSandHTTP

Page 2: lecture23-dns-hakimHowever, Internet routes and forwards requests based on IP addresses Need to convert name (e.g., ) to an IP address Domain Name System (DNS) Provides the mapping

WhatisDNS?

● Userhasnameofentityshe/hewantstoaccess● E.g.,www.cnn.com

● Content,host,etc.

● However,InternetroutesandforwardsrequestsbasedonIPaddresses● Needtoconvertname(e.g.,www.cnn.com)toanIPaddress

● DomainNameSystem(DNS)● ProvidesthemappingfromnametoIPaddress● UserasksDNS:whatistheIPaddressforwww.cnn.com● DNSresponds:157.166.255.18

Page 3: lecture23-dns-hakimHowever, Internet routes and forwards requests based on IP addresses Need to convert name (e.g., ) to an IP address Domain Name System (DNS) Provides the mapping

CorrectnessRequirements

● Addressescanchangeunderneath● Movewww.cnn.comto4.125.91.21● Humans/Applicationsshouldbeunaffected

● NamecouldmaptomultipleIPaddresses● www.cnn.comtomultiplereplicastotheWebsite● Toenable“loadbalancing”orreducedlatency

● Replicasmayseedifferentload(eg,duetogeographiclocation)● Somereplicasmaybeclosertotheuser

● Multiplenamesforthesameaddress● E.g.,www.cnn.comandcnn.comshouldmaptosameIPaddresses

Page 4: lecture23-dns-hakimHowever, Internet routes and forwards requests based on IP addresses Need to convert name (e.g., ) to an IP address Domain Name System (DNS) Provides the mapping

GoalsandApproach

● Goals● Correctness(frompreviousslide)● Scaling(names,users,updates,etc.)● Easeofmanagement(uniquenessofnames,etc.)● Availabilityandconsistency● Fastlookups

● Approach:Threeintertwinedhierarchies● HierarchicalNamespace:exploitstructureinnames● HierarchicalAdministration:hierarchyofauthorityovernames● HierarchicalInfrastructure:hierarchyofDNSservers

Page 5: lecture23-dns-hakimHowever, Internet routes and forwards requests based on IP addresses Need to convert name (e.g., ) to an IP address Domain Name System (DNS) Provides the mapping

HierarchicalNamespace

● “TopLevelDomains”(TLDs)areatthetop● Domainsaresubtrees

● E.g..edu,cornell.edu,cs.cornell.edu● Nameisleaf-to-rootpath

● systems.cs.cornell.edu

root

edu com gov mil org net uk fr

cornell mit

cs ece

systems

Page 6: lecture23-dns-hakimHowever, Internet routes and forwards requests based on IP addresses Need to convert name (e.g., ) to an IP address Domain Name System (DNS) Provides the mapping

HierarchicalAdministration

● Azonecorrespondstoanadministrativeauthorityresponsibleforcontiguousportionofhierarchy● Cornellcontrols*.cornell.edu● CScontrols*.cs.cornell.edu

● Namecollisionstriviallyavoided● Eachdomaincanensurethislocally

root

edu com gov mil org net uk fr

cornell mit

cs ece

systems

ICANN/IANA

Page 7: lecture23-dns-hakimHowever, Internet routes and forwards requests based on IP addresses Need to convert name (e.g., ) to an IP address Domain Name System (DNS) Provides the mapping

HierarchicalInfrastructure

● Topofhierarchy:root● Locationhardwiredintootherservers

● Nextlevel:TopLevelDomain(TLD)servers● .com,.edu,etc.

● Bottomlevel:AuthoritativeDNSservers● Actuallydothemapping● Canbemaintainedlocallyorbyaserviceprovider

Page 8: lecture23-dns-hakimHowever, Internet routes and forwards requests based on IP addresses Need to convert name (e.g., ) to an IP address Domain Name System (DNS) Provides the mapping

PerDomainAvailability

● DNSServersarereplicated● Primaryandsecondarynameserversarerequired● Nameserviceavailableifatleastonereplicaisup● Queriescanbeload-balancedamongreplicas

● Tryalternateserversontimeout● Exponentialbackoffwhenretryingthesameserver

Page 9: lecture23-dns-hakimHowever, Internet routes and forwards requests based on IP addresses Need to convert name (e.g., ) to an IP address Domain Name System (DNS) Provides the mapping

WhoKnowsWhat?

● Everyserverknowsaddressofrootnameserver

● RootserversknowtheaddressofallTLDservers

● Everynodeknowstheaddressofallchildren

● AnauthoritativeDNSserverstoresname-to-addressmappings(“resourcerecords”)forallDNSnamesinthedomainthatithasauthorityfor

● Therefore,eachserver:● StoresonlyasubsetofthetotalDNSdatabase(scalable!)● Candiscoverserver(s)foranyportionofthehierarchy

Page 10: lecture23-dns-hakimHowever, Internet routes and forwards requests based on IP addresses Need to convert name (e.g., ) to an IP address Domain Name System (DNS) Provides the mapping

BenefitsofThisApproach

● Scalableinnames,updates,lookups,users

● Highlyavailable:domainsreplicateindependently

● Extensible:canaddTLDsjustbychangingrootdb

● Autonomousadministration:● Eachdomainmanagesownnamesandservers● Andcanfurtherdelegate● Easilyensuresuniquenessofnames● Andconsistencyofdatabases

Page 11: lecture23-dns-hakimHowever, Internet routes and forwards requests based on IP addresses Need to convert name (e.g., ) to an IP address Domain Name System (DNS) Provides the mapping

DNSRecords(details)

● DNSserversstoreresourcerecords(RRs)● RRis(name,value,type,TTL)

● Type=A:(->Address)● Name=hostname● Value=IPaddress

● Type=NS:(->NameServer)● Name=domain● Value=nameofdnsserverfordomain

Page 12: lecture23-dns-hakimHowever, Internet routes and forwards requests based on IP addresses Need to convert name (e.g., ) to an IP address Domain Name System (DNS) Provides the mapping

● Type=MXL(->MaineXchanger)● name=domaininemailaddress● value=name(s)ofmainserver(s)

● Type=CNAME:(->CanonicalNAME)● Name=alias● Valueis“canonical”name

● Type=PTR:(->Pointer)● nameisreversedIP● valueiscorrespondinghostname

DNSRecords(detailscontinued)

Page 13: lecture23-dns-hakimHowever, Internet routes and forwards requests based on IP addresses Need to convert name (e.g., ) to an IP address Domain Name System (DNS) Provides the mapping

InsertingResourceRecordsintoDNS

● Example:youjustcreatedcompany“FooBar”

● YougetablockofIPaddressesfromyourISP● E.g.,212.44.9.128/25

● Registerfoobar.comatregistrar(e.g.,GoDaddy)● ProvideregistrarwithnamesandIPaddressesofyourauthoritativenameserver(s)

● RegistrarinsertsRRpairsintothe.comTLDserver:● (foobar.com,dns1.foobar.com,NS)● (dns1.foobar.com,212.44.9.129,A)

● Storeresourcerecordsinyourserverdns1.foobar.com● e.g.,typeArecordforwww.foobar.com● e.g.,typeMXrecordforfoobar.com

Page 14: lecture23-dns-hakimHowever, Internet routes and forwards requests based on IP addresses Need to convert name (e.g., ) to an IP address Domain Name System (DNS) Provides the mapping

DistributedHierarchicalDatabase

com edu org ac uk zw arpa

root

bar

west east

foo my

ac

cam

usr

in- addr

generic domains country domains

my.east.bar.edu usr.cam.ac.uk

Top-Level Domains (TLDs)

Everything scales but the root!

Page 15: lecture23-dns-hakimHowever, Internet routes and forwards requests based on IP addresses Need to convert name (e.g., ) to an IP address Domain Name System (DNS) Provides the mapping

DNSRoot

● Located in Virginia, USA● How do we make the root scale?

Verisign, Dulles, VA

Page 16: lecture23-dns-hakimHowever, Internet routes and forwards requests based on IP addresses Need to convert name (e.g., ) to an IP address Domain Name System (DNS) Provides the mapping

DNSRootServers

● 13 root servers (see http://www.root-servers.org/)● Labeled A through M

● How can we seamlessly scale this further?

B USC-ISI Marina del Rey, CA L ICANN Los Angeles, CA

E NASA Mt View, CA F Internet Software Consortium Palo Alto, CA

I Autonomica, Stockholm

K RIPE London

M WIDE Tokyo

A Verisign, Dulles, VA C Cogent, Herndon, VA D U Maryland College Park, MD G US DoD Vienna, VA H ARL Aberdeen, MD J Verisign

Page 17: lecture23-dns-hakimHowever, Internet routes and forwards requests based on IP addresses Need to convert name (e.g., ) to an IP address Domain Name System (DNS) Provides the mapping

Anycast

● Routingfindsshortestpathstodestination

● Ifseverallocationsaregiventhesameaddress:

● Networkwilldeliverthepackettoclosestlocationwiththataddress

● Thisiscalled“anycast”● Nomodificationofroutingisneededforthis….

● Allowsforseamlessreplicationofresources● Anyproblemswiththisapproach?

Page 18: lecture23-dns-hakimHowever, Internet routes and forwards requests based on IP addresses Need to convert name (e.g., ) to an IP address Domain Name System (DNS) Provides the mapping

DNSRootServers

● 13rootservers(seehttp://www.root-servers.org/)● LabeledAthroughM

● Replicationviaany-casting(localizedroutingforaddresses)

B USC-ISI Marina del Rey, CA L ICANN Los Angeles, CA

E NASA Mt View, CA F Internet Software Consortium Palo Alto, CA

I Autonomica, Stockholm

K RIPE London

M WIDE Tokyo

A Verisign, Dulles, VA C Cogent, Herndon, VA D U Maryland College Park, MD G US DoD Vienna, VA H ARL Aberdeen, MD J Verisign

Page 19: lecture23-dns-hakimHowever, Internet routes and forwards requests based on IP addresses Need to convert name (e.g., ) to an IP address Domain Name System (DNS) Provides the mapping

UsingDNS

● Twocomponents● LocalDNSservers● Resolversoftwareonhosts

● LocalDNSserver(“defaultnameserver”)● Usuallyneartheendhoststhatuseit● Localhostsconfiguredwithlocalserver(e.g,/etc/resolv.conf)orlearnserverviaDHCP

● Clientapplication● ObtainDNSname(e.g.,fromtheURL)● Dogethostbyname()totriggerresolvercode● WhichthensendsrequesttolocalDNSserver

Page 20: lecture23-dns-hakimHowever, Internet routes and forwards requests based on IP addresses Need to convert name (e.g., ) to an IP address Domain Name System (DNS) Provides the mapping

20

DNSclient (me.cs.cornell.edu)

rootservers

(mydns.cornell.edu) .eduservers

nyu.eduservers

LocalDNSserver

Page 21: lecture23-dns-hakimHowever, Internet routes and forwards requests based on IP addresses Need to convert name (e.g., ) to an IP address Domain Name System (DNS) Provides the mapping

21

DNSclient (me.cs.cornell.edu)

rootservers

.eduservers

nyu.eduservers

www.nyu.edu?

(mydns.cornell.edu)

LocalDNSserver

Page 22: lecture23-dns-hakimHowever, Internet routes and forwards requests based on IP addresses Need to convert name (e.g., ) to an IP address Domain Name System (DNS) Provides the mapping

22

root DNSserver

DNSclient (me.cs.cornell.edu)

.eduservers

nyu.eduservers

(mydns.cornell.edu)

www.nyu.edu?

LocalDNSserver

Page 23: lecture23-dns-hakimHowever, Internet routes and forwards requests based on IP addresses Need to convert name (e.g., ) to an IP address Domain Name System (DNS) Provides the mapping

23

root DNSserver

DNSclient (me.cs.cornell.edu)

.eduservers

nyu.eduservers

(mydns.cornell.edu)

www.nyu.edu?

LocalDNSserver

Page 24: lecture23-dns-hakimHowever, Internet routes and forwards requests based on IP addresses Need to convert name (e.g., ) to an IP address Domain Name System (DNS) Provides the mapping

24

root DNSserver

recursiveDNSquery

DNSclient (me.cs.cornell.edu)

(mydns.cornell.edu).eduservers

nyu.eduservers

www.nyu.edu?

LocalDNSserver

Page 25: lecture23-dns-hakimHowever, Internet routes and forwards requests based on IP addresses Need to convert name (e.g., ) to an IP address Domain Name System (DNS) Provides the mapping

25

root DNSserver

DNSclient (me.cs.cornell.edu)

(mydns.cornell.edu).eduservers

nyu.eduservers

LocalDNSserver

Page 26: lecture23-dns-hakimHowever, Internet routes and forwards requests based on IP addresses Need to convert name (e.g., ) to an IP address Domain Name System (DNS) Provides the mapping

root DNSserver

iterativeDNSquery

DNSclient (me.cs.cornell.edu)

(mydns.cornell.edu).eduservers

nyu.eduservers

Where is .edu?

Where is www.nyu.edu?

Where is nyu.edu?

LocalDNSserver

Page 27: lecture23-dns-hakimHowever, Internet routes and forwards requests based on IP addresses Need to convert name (e.g., ) to an IP address Domain Name System (DNS) Provides the mapping

DNSProtocol

● QueryandReplymessages● Bothwiththesamemessageformat● seetextfordetails

● Client-ServerinteractiononUDPPort53● SpecsupportsTCPtoo,butnotalwaysimplemented● Reliabilityviarepeatingrequestsontimeout

● Resolutionisalmostalways“iterative”

Page 28: lecture23-dns-hakimHowever, Internet routes and forwards requests based on IP addresses Need to convert name (e.g., ) to an IP address Domain Name System (DNS) Provides the mapping

Goals

● Scaling(names,users,updates,etc.)● Yes

● Easeofmanagement(uniquenessofnames,etc.)● Yes

● Availabilityandconsistency● Yes

● Fastlookups● ??

Page 29: lecture23-dns-hakimHowever, Internet routes and forwards requests based on IP addresses Need to convert name (e.g., ) to an IP address Domain Name System (DNS) Provides the mapping

root DNSserver

iterativeDNSquery

DNSclient (me.cs.cornell.edu)

(mydns.cornell.edu).eduservers

nyu.eduservers

Where is .edu?

Where is www.nyu.edu?

Where is nyu.edu?

LocalDNSserver

Page 30: lecture23-dns-hakimHowever, Internet routes and forwards requests based on IP addresses Need to convert name (e.g., ) to an IP address Domain Name System (DNS) Provides the mapping

DNSCaching

● HowDNScachingworks● DNSserverscacheresponsestoqueries● Responsesincludea“timetolive”(TTL)field● ServerdeletescachedentryafterTTLexpires

● Whycachingiseffective● Thetop-levelserversveryrarelychange● Popularsitesvisitedoften->localDNSserveroftenhastheinformationcached

Page 31: lecture23-dns-hakimHowever, Internet routes and forwards requests based on IP addresses Need to convert name (e.g., ) to an IP address Domain Name System (DNS) Provides the mapping

Questions?

Page 32: lecture23-dns-hakimHowever, Internet routes and forwards requests based on IP addresses Need to convert name (e.g., ) to an IP address Domain Name System (DNS) Provides the mapping

TheWeb

Page 33: lecture23-dns-hakimHowever, Internet routes and forwards requests based on IP addresses Need to convert name (e.g., ) to an IP address Domain Name System (DNS) Provides the mapping

TheWeb–Precursor

● 1967,TedNelson,Xanadu:● Aworld-widepublishingnetworkthatwouldallowinformationtobestorednotasseparatefilesbutasconnectedliterature

● Ownersofdocumentswouldbeautomaticallypaidviaelectronicmeansforthevirtualcopyingoftheirdocuments

● Coinedtheterm“Hypertext”● Influencedresearchcommunity

● Whothenmissedtheweb…..

Ted Nelson

Page 34: lecture23-dns-hakimHowever, Internet routes and forwards requests based on IP addresses Need to convert name (e.g., ) to an IP address Domain Name System (DNS) Provides the mapping

TheWeb–Precursor

● Physicisttryingtosolverealproblem● Distributedaccesstodata

● WorldWideWeb(WWW):adistributeddatabaseof“pages”linkedthroughHypertextTransportProtocol(HTTP)● FirstHTTPimplementation-1990

● TimBerners-LeeatCERN● HTTP/0.9–1991

● SimpleGETcommandfortheWeb● HTTP/1.0–1992

● Client/Serverinformation,simplecaching● HTTP/1.1-1996

Tim Berners-Lee

Page 35: lecture23-dns-hakimHowever, Internet routes and forwards requests based on IP addresses Need to convert name (e.g., ) to an IP address Domain Name System (DNS) Provides the mapping

WebComponents

● Infrastructure:● Clients● Servers● Proxies

● Content:● Individualobjects(files,etc.)● Websites(coherentcollectionofobjects)

● Implementation● URL:namingcontent● HTTP:protocolforexchangingcontent

Page 36: lecture23-dns-hakimHowever, Internet routes and forwards requests based on IP addresses Need to convert name (e.g., ) to an IP address Domain Name System (DNS) Provides the mapping

URLSyntax

protocol http, ftp, https, smtp, rtsp, etc.

hostname DNS name, IP address

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

directory path Hierarchical, reflecting 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

protocol://hostname[:port]/directorypath/resource

Page 37: lecture23-dns-hakimHowever, Internet routes and forwards requests based on IP addresses Need to convert name (e.g., ) to an IP address Domain Name System (DNS) Provides the mapping

WebandDNS

● URLsusehostnames

● Thus,contentnamesaretiedtospecifichosts

● Whyisthisaproblem?

● Makespersistenceofnamesproblematic…

Page 38: lecture23-dns-hakimHowever, Internet routes and forwards requests based on IP addresses Need to convert name (e.g., ) to an IP address Domain Name System (DNS) Provides the mapping

HyperTextTransferProtocol(HTTP)

● Client-serverarchitecture● Serveris“alwayson”and“wellknown”● Clientsinitiatecontacttoserver

● Synchronousrequest/replyprotocol● Runsontopoftransportlayer,Port80

● Stateless

● ASCIIformat

Page 39: lecture23-dns-hakimHowever, Internet routes and forwards requests based on IP addresses Need to convert name (e.g., ) to an IP address Domain Name System (DNS) Provides the mapping

GET /somedir/page.html HTTP/1.1 Host: www.someschool.edu User-agent: Mozilla/4.0 Connection: close Accept-language: fr (blank line)

● Request line: method, resource, and protocol version ● Request headers: provide information or modify request ● Body: optional data (e.g., to “POST” data to the server)

request line

header lines

carriage return line feed indicates end of message

HTTPrequestmessage

Page 40: lecture23-dns-hakimHowever, Internet routes and forwards requests based on IP addresses Need to convert name (e.g., ) to an IP address Domain Name System (DNS) Provides the mapping

● Status line: protocol version, status code, status phrase ● Response headers: provide information ● Body: optional data

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 ...

status line (protocol, status code, status phrase)

header lines

data e.g., requested HTML file

HTTPresponsemessage

Page 41: lecture23-dns-hakimHowever, Internet routes and forwards requests based on IP addresses Need to convert name (e.g., ) to an IP address Domain Name System (DNS) Provides the mapping

HTTPisStateless

● Eachrequest-responsetreatedindependently● ServersnotrequiredtoretainstateforHTTP

● Theapplicationmayhavelotsofstate,butnotHTTP

● Good:Improvesscalabilityontheserver-side● Failurehandlingiseasier● Canhandlehigherrateofrequests● Orderofrequestsdoesn’tmatter(toHTTP)

● Bad:Someapplicationsneedpersistentstate● Needtouniquelyidentifyuserorstoretemporaryinfo● e.g.,Shoppingcart,userprofiles,usagetracking,…

Page 42: lecture23-dns-hakimHowever, Internet routes and forwards requests based on IP addresses Need to convert name (e.g., ) to an IP address Domain Name System (DNS) Provides the mapping

Question

● How does a stateless protocol keep state?

Page 43: lecture23-dns-hakimHowever, Internet routes and forwards requests based on IP addresses Need to convert name (e.g., ) to an IP address Domain Name System (DNS) Provides the mapping

StateinaStatelessProtocol:Cookies

● Client-sidestatemaintenance● Clientstoressmallstateonbehalfofserver● Clientsendsstateinfuturerequeststotheserver

● Canprovideauthentication

Request

Response Set-Cookie: XYZ

Request Cookie: XYZ

Page 44: lecture23-dns-hakimHowever, Internet routes and forwards requests based on IP addresses Need to convert name (e.g., ) to an IP address Domain Name System (DNS) Provides the mapping

HTTPPerformanceIssues

Page 45: lecture23-dns-hakimHowever, Internet routes and forwards requests based on IP addresses Need to convert name (e.g., ) to an IP address Domain Name System (DNS) Provides the mapping

PerformanceGoals

● User● Fastdownloads● Highavailability

● Contentprovider● Happyusers(hence,above)● Cost-effectiveinfrastructure

● Network(secondary)● Avoidoverload

Cachingandreplicationresolvemostoftheseissues

Page 46: lecture23-dns-hakimHowever, Internet routes and forwards requests based on IP addresses Need to convert name (e.g., ) to an IP address Domain Name System (DNS) Provides the mapping

HTTPPerformance

● MostWebpageshavemultipleobjects● e.g.,HTMLfileandabunchofembeddedimages

● Howdoyouretrievethoseobjects(naively)?● Oneitematatime

● Newconnectionper(small)object!

● Requires2RTTsworthoflatencyperobject

Page 47: lecture23-dns-hakimHowever, Internet routes and forwards requests based on IP addresses Need to convert name (e.g., ) to an IP address Domain Name System (DNS) Provides the mapping

ImprovingHTTPPerformance

● PersistentConnections

● Maintainconnectionacrossmultiplerequests● Includingtransferssubsequenttocurrentpage● Clientorservercanteardownconnection

● Performanceadvantages:● Avoidoverheadofconnectionset-upandtear-down

● DefaultinHTTP/1.1

Page 48: lecture23-dns-hakimHowever, Internet routes and forwards requests based on IP addresses Need to convert name (e.g., ) to an IP address Domain Name System (DNS) Provides the mapping

ImprovingHTTPPerformance

● PipelinedRequestsandResponses

● Batchrequestsandresponsestoreducethenumberofpackets

Client Server

Request 1Request 2Request 3

Transfer 1

Transfer 2

Transfer 3

Page 49: lecture23-dns-hakimHowever, Internet routes and forwards requests based on IP addresses Need to convert name (e.g., ) to an IP address Domain Name System (DNS) Provides the mapping

Questions?

Page 50: lecture23-dns-hakimHowever, Internet routes and forwards requests based on IP addresses Need to convert name (e.g., ) to an IP address Domain Name System (DNS) Provides the mapping

ImprovingHTTPPerformance:Caching

● Whydoescachingwork?● Exploitslocalityofreference

● Howwelldoescachingwork?● Verywell,uptoalimit

● Filepopularityhashighpeakbutlongtail● Largeoverlapinhighlypopularcontent● Butmanyuniquerequests

● Auniversalstory!● Hitrateofcachegrowslogarithmicallywithsize

Page 51: lecture23-dns-hakimHowever, Internet routes and forwards requests based on IP addresses Need to convert name (e.g., ) to an IP address Domain Name System (DNS) Provides the mapping

ImprovingHTTPPerformance:Caching-How?

● ModifiertoGETrequests:● If-modified-since—returns“notmodified”ifresourcenotmodifiedsincespecifiedtime

● Clientspecifies“if-modified-since”timeinrequest

● Servercomparesthisagainst“lastmodified”timeofresource

● Serverreturns“NotModified”ifresourcehasnotchanged

● ….ora“OK”withthelatestversionotherwise

Page 52: lecture23-dns-hakimHowever, Internet routes and forwards requests based on IP addresses Need to convert name (e.g., ) to an IP address Domain Name System (DNS) Provides the mapping

ImprovingHTTPPerformance:Caching-How?

● ModifiertoGETrequests:● If-modified-since—returns“notmodified”ifresourcenotmodifiedsincespecifiedtime

● Responseheader:● Expires—TTL:howlongit’ssafetocachetheresource● No-cache—ignoreallcaches;alwayshetresourcedirectlyfromserver

Page 53: lecture23-dns-hakimHowever, Internet routes and forwards requests based on IP addresses Need to convert name (e.g., ) to an IP address Domain Name System (DNS) Provides the mapping

TypicalCachingInteraction

● Clientissuesrequestforobject

● Ifitisinlocalclientcache:● IfwithinTTL,respondtoclient● IfnotwithinTTL,sendif-modified-sincetoserver

● Ifserverhasupdatedcopy,itsendsit● Ifnot,serverrespondssayingthatitdoesn’t

● Ifnotinlocalclientcache:● Sendrequesttoserver● Thisrequestmaypassthroughothercaches,whichuseasimilaralgorithm

Page 54: lecture23-dns-hakimHowever, Internet routes and forwards requests based on IP addresses Need to convert name (e.g., ) to an IP address Domain Name System (DNS) Provides the mapping

ImprovingHTTPPerformance:Caching-Where?

● Options● Client● Forwardproxies● Reverseproxies● ContentDistributionNetwork

Page 55: lecture23-dns-hakimHowever, Internet routes and forwards requests based on IP addresses Need to convert name (e.g., ) to an IP address Domain Name System (DNS) Provides the mapping

ImprovingHTTPPerformance:Caching-Where?

● Baseline:Manyclientstransfersameinformation● Generateunnecessaryserverandnetworkload● Clientsexperienceunnecessarylatency

Server

Clients

Tier-1 ISP

ISP-1 ISP-2

Page 56: lecture23-dns-hakimHowever, Internet routes and forwards requests based on IP addresses Need to convert name (e.g., ) to an IP address Domain Name System (DNS) Provides the mapping

CachingwithReverseProxies

● Cachedocumentsclosetoserver● Decreaseserverload

● Typicallydonebycontentprovider

Clients

Backbone ISP

ISP-1 ISP-2

Server

Reverse proxies

Page 57: lecture23-dns-hakimHowever, Internet routes and forwards requests based on IP addresses Need to convert name (e.g., ) to an IP address Domain Name System (DNS) Provides the mapping

CachingwithForwardProxies

● Cachedocumentsclosetoclients● Reducenetworktrafficanddecreaselatency

● TypicallydonebyISPsorenterprises

Clients

Backbone ISP

ISP-1 ISP-2

Server

Reverse proxies

Forward proxies

Page 58: lecture23-dns-hakimHowever, Internet routes and forwards requests based on IP addresses Need to convert name (e.g., ) to an IP address Domain Name System (DNS) Provides the mapping

ImprovingHTTPPerformance:Replication

● ReplicatepopularWebsiteacrossmanymachines● Spreadsloadonservers● Placescontentclosertoclients● Helpswhencontentisn’tcacheable

● Problem:Wanttodirectclienttoparticularreplica● Balanceloadacrossserverreplicas● Pairclientswithnearbyservers

● Commonsolution:● DNSreturnsdifferentaddressesbasedonclient’sgeolocation,serverload,etc.

Page 59: lecture23-dns-hakimHowever, Internet routes and forwards requests based on IP addresses Need to convert name (e.g., ) to an IP address Domain Name System (DNS) Provides the mapping

ContentDistributionNetworks

● Cachingandreplicationasaservice

● Large-scaledistributedstorageinfrastructure(usually)administeredbyoneentity● e.g.,Akamaihasserversin20,000+locations

● Combinationof(pull)cachingand(push)replication● Pull:Directresultofclients’requests● Push:Expectationofhighaccessrate

● Alsodosomeprocessing● Handledynamicwebpages● Transcoding

Page 60: lecture23-dns-hakimHowever, Internet routes and forwards requests based on IP addresses Need to convert name (e.g., ) to an IP address Domain Name System (DNS) Provides the mapping

CDNExample—Akamai

● Akamaicreatesnewdomainnamesforeachclient● e.g.,a128.g.akamai.netforcnn.com

● TheCDN’sDNSserversareauthoritativeforthenewdomains

● TheclientcontentprovidermodifiesitscontentsothatembeddedURLsreferencethenewdomains.● “Akamaize”content● e.g.:http://www.cnn.com/image-of-the-day.gifbecomeshttp://a128.g.akamai.net/image-of-the-day.gif

● RequestsnowsenttoCDN’sinfrastructure…

Page 61: lecture23-dns-hakimHowever, Internet routes and forwards requests based on IP addresses Need to convert name (e.g., ) to an IP address Domain Name System (DNS) Provides the mapping

Cost-EffectiveContentDelivery

● Generaltheme:multiplesiteshostedonsharedphysicalinfrastructure● efficiencyofstatisticalmultiplexing● economiesofscale(volumepricing,etc.)● amortizationofhumanoperatorcosts

● Examples:● Webhostingcompanies● CDNs● Cloudinfrastructure

Page 62: lecture23-dns-hakimHowever, Internet routes and forwards requests based on IP addresses Need to convert name (e.g., ) to an IP address Domain Name System (DNS) Provides the mapping

Questions?

Page 63: lecture23-dns-hakimHowever, Internet routes and forwards requests based on IP addresses Need to convert name (e.g., ) to an IP address Domain Name System (DNS) Provides the mapping

Backupslide:HistoryofDNS

● Originally:per-hostfilehosts.txtin/etc/hosts● SRI(MenloPark)keptmastercopy● Downloadedregularly● Flatnamespaces

● AstheInternetgrewthissystembrokedown● SRIcouldn’thandletheload● Conflictsinselectingnames● Hostshadinaccuratecopiesofhosts.txt

● DomainNameSystem(DNS)inventedtofixthis● Firstserverimplementationdoneby4UCBstudents!

Page 64: lecture23-dns-hakimHowever, Internet routes and forwards requests based on IP addresses Need to convert name (e.g., ) to an IP address Domain Name System (DNS) Provides the mapping

DNSMeasurements(MITdatafrom2000)

● What is being looked up?● ~60% requests for A records● ~25% for PTR records● ~5% for MX records● ~6% for ANY (wildcard) records

● How long does it take?● Median ~100msec (but 90th percentile ~500msec)● 80% have no referrals; 99.9% have fewer than four

● Query packets per lookup: ~2.4● But this is misleading….

Page 65: lecture23-dns-hakimHowever, Internet routes and forwards requests based on IP addresses Need to convert name (e.g., ) to an IP address Domain Name System (DNS) Provides the mapping

DNSMeasurements(MITdatafrom2000)

● Does DNS give answers?● ~23% of lookups fail to elicit an answer!● ~13% of lookups result in NXDOMAIN (or similar)

● Mostly reverse lookups● Only ~64% of queries are successful!

● How come the web seems to work so well?

● ~ 63% of DNS packets in unanswered queries!● Failing queries are frequently retransmitted● 99.9% successful queries have ≤2 requests

Page 66: lecture23-dns-hakimHowever, Internet routes and forwards requests based on IP addresses Need to convert name (e.g., ) to an IP address Domain Name System (DNS) Provides the mapping

MoraloftheStory

● The Internet was designed to be highly resilient.● No matter what goes wrong, it tries to recover

● In a highly resilient system, many things can be going wrong without you noticing it!

Page 67: lecture23-dns-hakimHowever, Internet routes and forwards requests based on IP addresses Need to convert name (e.g., ) to an IP address Domain Name System (DNS) Provides the mapping

DNSMeasurements(MITdatafrom2000)

● Top 10% of names accounted for ~70% of lookups● Caching should really help!

● 9% of lookups are unique● Cache hit rate can never exceed 91%

● Cache hit rates ~ 75%● But caching for more than 10 hosts doesn’t add much

Page 68: lecture23-dns-hakimHowever, Internet routes and forwards requests based on IP addresses Need to convert name (e.g., ) to an IP address Domain Name System (DNS) Provides the mapping

ACommonPattern…..

● Distributions of various metrics (file lengths, access patterns, etc.) often have two properties:● Large fraction of total metric in the top 10%● Sizable fraction (~10%) of total fraction in low values

● In an exponential distribution● Large fraction is in top 10%● But low values have very little of overall total

● Lesson: in networking, have to pay attention to both ends of distribution (high peak and long tail)● Here, caching helps, but not a panacea

Page 69: lecture23-dns-hakimHowever, Internet routes and forwards requests based on IP addresses Need to convert name (e.g., ) to an IP address Domain Name System (DNS) Provides the mapping

Whynotnamecontentdirectly?

● How do you know where to send the request?

● How do you scale?

● How do you trust the response?● Requesting host● Network

● How would you design it?

Page 70: lecture23-dns-hakimHowever, Internet routes and forwards requests based on IP addresses Need to convert name (e.g., ) to an IP address Domain Name System (DNS) Provides the mapping

Scorecard:GettingnSmallObjects

● Time dominated by latency

● One at a time: ~2n RTT

● M concurrent: ~2[n/m] RTT

● Persistent: ~(n+1) RTT

● Pipelined: ~2 RTT

● Pipelined/Persistent: ~2RTT first time, RTT later

Page 71: lecture23-dns-hakimHowever, Internet routes and forwards requests based on IP addresses Need to convert name (e.g., ) to an IP address Domain Name System (DNS) Provides the mapping

Scorecard:GettingnLargeObjects

● Time dominated by bandwidth

● One at a time: ~nF/B

● M concurrent: it depends● If more flows get no additional bandwidth: ~nF/B● If shared with large population of users: ~[n/m] F/B

● Where each TCP connection gets the same bandwidth

● Pipelined and/or Persistent: ~nF/B● The only thing that helps is getting more bandwidth