Lecture 3 - Packet Delays - How the Internet works Rachit ... · • Delay: Time for all bits to go...

47
Computer Networks: Architecture and Protocols CS4450 Lecture 3 - Packet Delays - How the Internet works Rachit Agarwal

Transcript of Lecture 3 - Packet Delays - How the Internet works Rachit ... · • Delay: Time for all bits to go...

ComputerNetworks:

ArchitectureandProtocols

CS4450

Lecture3-PacketDelays

-HowtheInternetworks

RachitAgarwal

ContextforandGoalsofToday’sLecture

• Today’slectureisgoingtobeoneofthehardestlectures• Ifyouunderstandeverything

• Thereissomethingwrong!

• Goals:• Wrapupdiscussionontransmissionandpropagationdelays

• HowdoestheInternetwork?• Anend-to-endview

But,asusual,letsstartwith:

whatwehavelearntsofar

Asetofnetworkelementsconnectedtogether,thatimplementasetofprotocolsforthepurposeofsharingresourcesattheendhosts

Recap:Whatisacomputernetwork?

Recap:networkcanbeabstractlyrepresentedasagraph

PathSource

Destination

Source

Destination

Path

Recap:Sharingthenetwork

PathSource

Destination

Source

Destination

Path

Recap:Performancemetricsincomputernetworks!

• Bandwidth:Numberofbitssentpersecond(bitspersecond,orbps)

• Dependsonhardware,networktrafficconditions,…

• Delay:Timeforallbitstogofromsourcetodestination(seconds)

• Dependsonhardware,distance,trafficfromothersources,…

• Manyotherperformancemetrics

• Reliability,fairness,etc.• Wewillcomebacktoothermetricslater…

• First:Reservations• Reserve(peak)bandwidthneededinadvance

• Onewaytoimplementreservations:circuitswitching

• Sourcesendsareservationrequestforpeakdemandtodestination

• Switches/routersestablisha“circuit”• Sourcesendsdata• Sourcesendsa“teardowncircuit”message

Recap:Twoapproachestosharingnetworks

Circuitswitching:anexample(redrequestfails)

Source

Destination

Source

Destination

Bandwidth=100Mbps

Request=100Mbps

Source

Destination

Source

Destination

Bandwidth=100Mbps

Request=10Mbps

Request=10Mbps

Circuitswitching:anotherexample(redrequestsucceeds)

• Goods:• Predictableperformance

• Reliabledelivery• Simpleforwardingmechanism

• Not-so-goods• Handlingfailures• Resourceunderutilization• Blockedconnections• Connectionsetupoverheads• Per-connectionstateinswitches(scalabilityproblem)

Recap:Circuitswitching(reservation-basedsharing)summary

• Breakdataintosmallerpieces

• Packets!

• Transmitthepacketswithoutanyreservations

• And,hopeforthebest

Recap:Solution:Packetswitching

• Goods:• Withpropermechanismsinplace

• Easiertohandlefailures• Noresourceunderutilization

• Asourcecansendmoreifothersdon’tuseresources

• Noblockedconnectionproblem

• Noper-connectionstate• Noset-upcost

• Not-so-goods:• Unpredictableperformance

• Highlatency• Packetheaderoverhead

Recap:Packetswitchingsummary

Bothembodystatisticalmultiplexing

• Reservation:sharingatconnectionlevel• Resourcessharedbetweenconnectionscurrentlyinsystem

• Reservethepeakdemand

• On-demand:sharingatpacketlevel

• Resourcessharedbetweenpacketscurrentlyinsystem

• Resourcesgivenoutonpacket-by-packetbasis• Noreservationofresources

Recap:Twoapproachestosharingnetworks

• Consistsofsixcomponents

• Linkproperties:• Transmissiondelay

• Propagationdelay

• OSinternals:• Processingdelay• Queueingdelay

• Trafficmatrixandswitchinternals:

• Processingdelay• Queueingdelay

• First,considertransmission,propagationdelays

• Queueingdelayandprocessingdelayslaterinthecourse

Recap:packetdelay/latency

• Transmissiondelay:

• Timetakentopushallthebitsofapacketintoalink

• =Packetsize/Linkbandwidth• Ifpacketsize=1000bytes,bandwidth=100Mbps:~80us

• Propagationdelay:• Timetakentomoveonebitfromoneendofthelinktoother

• =Linklength/Speedoflight• Iflength=30000m:~100us

• Independentofpacketsizeandbandwidth

Recap:Transmissionandpropagationdelay

Questions?

GroupExercise:

Howlongdoesittakeforapacketonalink?

Constraints:

• Packetsize=1000Byte• Bandwidth=100Mbps

• Length=30,000m

SolutiontoGroupExercise:

Howlongdoesittakeforapacketonalink?

~180us

Why?

Questions?

Today’slecture:HowdoestheInternetwork?

1. Diveintoend-to-end:fromsourcetodestination

2. Firstlookintoswitches:routing,queueing,forwarding

3. Firstlookintonetworkstack:sockets,ports,“thestack”

HowdoestheInternetwork?

Anend-to-endview

• Naming,addressing:Locatingthedestination

• Routing:Findingapathtothedestination

• Forwarding:Sendingdatatothedestination

• Reliability:Handlingfailures,packetdrops,etc.

Fourfundamentalproblems!

Naming,Routing,Forwarding,Reliability

• Eachismotivatedbyaclearneed

• Thesolutionsarenotalwayscleanordeep

• Butifyoukeepinmindwhattheproblemis

• You’llbeabletounderstandthesolutions• Whentherighttimecomes:-)

Fourfundamentalproblems!

Willtaketheentirecoursetolearnthese:

Letsgetanend-to-endpicture!

• NetworkAddress:wherehostislocated• Requiresanaddressforthedestinationhost

• HostName:whichhostitis

• whydoweneedaname?

• Answer:Whenyoumoveahosttonewbuilding

• Addresschanges• Namedoesnotchange

• Samethingwithyourownnameandaddress!

• Remembertheanalogy:humannames,addresses,postoffice,letters

Fundamentalproblem#1:NamingandAddressing

• Considerwhenyouaccessawebpage• InsertURLintobrowser(eg,www.cornell.edu)• Packetssenttowebsite(reliably)• Packetreachapplicationondestinationhost

• Howdoyougettothewebsite?• URLisuser-levelname(eg,www.cornell.edu)

• Networkneedsaddress(eg,whereiswww.cornell.edu)?

• Mustmapnamestoaddresses

• Justlikeweuseanaddressbooktomaphumannamestoaddresses

Namesversusaddresses

• OntheInternet,weonlynamehosts(sortof)

• URLsarebasedonthenameofthehostcontainingthecontent(that

is,www.cornell.edunamesahost)

• Beforeyoucansendpacketstowww.cornell.edu,youmustresolvenames

intothehost’saddress

• DonebytheDomainNameSystem(DNS)

MappingNamestoAddresses

Thesourceknowsthename;

MapsthatnametoanaddressusingDNS!

Questions?

Routingpacketsthroughnetworkelements(eg,routers)todestination

• Givendestinationaddress(andname),howdoeseachswitch/router

knowwheretosendthepacketsothatthepacketreachesitsdestination

• Whenapacketarrivesatarouter

• aroutingtabledetermineswhichoutgoinglinkthepacketissenton

• Computedusingroutingprotocols

Fundamentalproblem#2

• Distributedalgorithmthatrunsbetweenrouters

• Distributedmeansnosinglerouterhas“full”viewofthenetwork

• Exchangeofmessagestogather“enough”information…

• …aboutthenetworktopology

• Computepathsthroughthattopology

• Storeforwardinginformationineachrouter

• IfpacketisdestinedforX,sendoutusinglinkl1• IfpacketisdestinedforY,sendoutusinglinkl2• Canpacketsgoingtodifferentdestinationssentouttosamelink?

• Wecallthisaroutingtable

Routingprotocols(conceptually)

Questions?

QueueingandForwardingofpacketsatswitches/routers

Fundamentalproblem#3

Inputqueue

Virtualoutputqueue

Outputqueue

QueueingandForwardingofpacketsatswitches/routers

• Queueing:Whenapacketarrives,storeitin“inputqueues”

• Eachincomingqueuedividedintomultiplevirtualoutputqueues

• Onevirtualoutputqueueperoutgoinglink• Whenapacketarrives:

• Lookupitsdestination’saddress(how?)• Findthelinkonwhichthepacketwillbeforwarded(how?)• Storethepacketincorrespondingvirtualoutputqueue

• Forwarding:Whentheoutgoinglinkfree

• Pickapacketfromthecorrespondingvirtualoutputqueue

• forwardthepacket!

Fundamentalproblem#3

• Packetsmustdescribewhereitshouldbesent

• Requiresanaddressforthedestination

• Packetsmustdescribewhereitscomingfrom

• Forhandlingfailures,etc.• Requiresanaddressforthesource

• Packetsmustcarrydata

• canbebitsinafile,image,whatever

Whatmustpacketscarrytoenableforwarding?

Header Data

• Processingdelay• Easy;eachswitch/routerneedstodecidewheretoputpacket• Requirescheckingheader,etc.

• Queueingdelay• Harder;dependson“howmanypacketsareinfrontofme”

• Dependsonnetworkload• Asloadincreases,queueingdelayincreases

• Inanextremecase,increaseinnetworkload

• resultsinpacketdrops

• Wewillreturntothisinmuchmoredepthlater…

SwitchProcessingandQueueingdelay

Questions?

Howdoyoudeliverpacketsreliable?

• Packetscanbedroppedalongtheway• Buffersinroutercanoverflow• Routerscancrashwhilebufferingpackets• Linkscangarblepackets

• Howdoyoumakesurepacketsarrivesafelyonanunreliablenetwork?

• Or,atleast,knowiftheyaredelivered?• Wantnofalsepositives,andhighchangeofsuccess

Fundamentalproblem#4

• Whoisresponsibleforthis?(architecture)

• Network?• Host?

• Howisitimplemented?(engineering)

• Wewillconsiderbothperspectives

Twoquestionsaboutreliability

Questions?

• Wenowhavetheaddressofthewebsite

• And,aroute/pathtothedestination• And,mechanismsinplacetoforwardthepacketsateachswitch/router

• Inareliablemanner

• So,wecansendpacketsfromsourcetodestination

• Arewedone?

• Whenapacketarrivesatahost,whatdoesthehostdowithit?

• Towhichprocess(application)shouldthepacketbesent?

• Ifthepacketheaderonlyhasthedestinationaddress,howdoesthehostknowwheretodeliverpacket?

• Theremaybemultipleapplicationsonthatdestination

Finishingourstory

• Whoputsthesourceaddress,sourceport,destinationaddress,

destinationportinthepacketheader?

Andwhilewearefinishingourstory….

Thefinalpieceinthegame:End-hoststack

OfSocketsandPorts

• Whenaprocesswantsaccesstothenetwork,itopensasocket,whichis

associatedwithaport

• Socket:anOSmechanismthatconnectsprocessestothenetworkstack

• Port:numberthatidentifiesthatparticularsocket

• TheportnumberisusedbytheOStodirectincomingpackets

• PacketHeadermustinclude:

• Destinationaddress(usedbynetwork)• Destinationport(usedbynetworkstack)• And?• Sourceaddress(usedbynetwork)• Sourceport(usedbynetworkstack)

• Whenapacketarrivesatthedestinationhost,packetisdeliveredtothe

socketassociatedwiththedestinationport

• Moredetailslater

ImplicationsforPacketHeader

• Network:Deliverpacketsfromhosttohost(basedonaddress)

• Networkstack(OS):Deliverpacketstoappropriatesocket(basedonport)

• Applications:• Sendandreceivepackets• Understandcontentofpacketbodies

Separationofconcerns

SecretoftheInternet’ssuccessisgetting

theseandotherabstractionsright

• Applicationopensasocketthatallowsittoconnecttothenetworkstack

• MapsnameofthewebsitetoitsaddressusingDNS

• Thenetworkstackatthesourceembedstheaddressandportforboththesourceandthedestinationinpacketheader

• Eachrouterconstructsaroutingtableusingadistributedalgorithm

• Eachrouterusesdestinationaddressinthepacketheadertolookuptheoutgoinglinkintheroutingtable

• Andwhenthelinkisfree,forwardsthepacket

• Whenapacketarrivesthedestination:

• Thenetworkstackatthedestinationusestheporttoforwardthepackettotherightapplication

Theend-to-endstory

• TheInternetisahuge,complicatedsystem

• Onecanstudythepartsinisolation• Routing• Ports,sockets• Networkstack• …

• Butthepiecesallfittogetherinaparticularway

• Todaywasquickoverviewofhowpiecesfit…• Don’tworryifyoudidn’tunderstandmuchofit

• Youprobablyabsorbedmorethanyourealize

Today’slecture