Queuing and Queue Management - Computer Science … · Queuing and Queue Management ... Detecon (of...
-
Upload
doankhuong -
Category
Documents
-
view
227 -
download
3
Transcript of Queuing and Queue Management - Computer Science … · Queuing and Queue Management ... Detecon (of...
![Page 1: Queuing and Queue Management - Computer Science … · Queuing and Queue Management ... Detecon (of congeson) ... Fabric Processor Line card Line card Line card Line card data plane](https://reader031.fdocuments.us/reader031/viewer/2022021501/5ac14e237f8b9a357e8c81ea/html5/thumbnails/1.jpg)
QueuingandQueueManagementReading:Sec1ons6.2,6.4,6.5
COS461:ComputerNetworksSpring2011
MikeFreedmanhEp://www.cs.princeton.edu/courses/archive/spring11/cos461/
1
![Page 2: Queuing and Queue Management - Computer Science … · Queuing and Queue Management ... Detecon (of congeson) ... Fabric Processor Line card Line card Line card Line card data plane](https://reader031.fdocuments.us/reader031/viewer/2022021501/5ac14e237f8b9a357e8c81ea/html5/thumbnails/2.jpg)
GoalsofToday’sLecture
• RouterQueuingModels– Limita1onsofFIFOandDropTail
• SchedulingPolicies– FairQueuing
• Droppolicies– RandomEarlyDetec1on(ofconges1on)
– ExplicitConges1onNo1fica1on(fromrouters)
• Someaddi1onalTCPmechanisms
2
![Page 3: Queuing and Queue Management - Computer Science … · Queuing and Queue Management ... Detecon (of congeson) ... Fabric Processor Line card Line card Line card Line card data plane](https://reader031.fdocuments.us/reader031/viewer/2022021501/5ac14e237f8b9a357e8c81ea/html5/thumbnails/3.jpg)
RouterDataandControlPlanes3
Switching Fabric
Processor
Line card
Line card
Line card
Line card
Line card
Line card
data plane
control plane
![Page 4: Queuing and Queue Management - Computer Science … · Queuing and Queue Management ... Detecon (of congeson) ... Fabric Processor Line card Line card Line card Line card data plane](https://reader031.fdocuments.us/reader031/viewer/2022021501/5ac14e237f8b9a357e8c81ea/html5/thumbnails/4.jpg)
LineCards(InterfaceCards,Adaptors)• Interfacing
– Physicallink– Switchingfabric
• Packethandling– Packetforwarding– Decrement1me‐to‐live– Buffermanagement– Linkscheduling– Packetfiltering– Ratelimi1ng– Packetmarking– Measurement
4
to/from link
to/from switch
lookup
Rec
eive
Transmit
![Page 5: Queuing and Queue Management - Computer Science … · Queuing and Queue Management ... Detecon (of congeson) ... Fabric Processor Line card Line card Line card Line card data plane](https://reader031.fdocuments.us/reader031/viewer/2022021501/5ac14e237f8b9a357e8c81ea/html5/thumbnails/5.jpg)
PacketSwitchingandForwarding5
R1 Link 1
Link 2
Link 3
Link 4
Link 1, ingress Link 1, egress
Link 2, ingress Link 2, egress
Link 3, ingress Link 3, egress
Link 4, ingress Link 4, egress
Choose Egress
Choose Egress
Choose Egress
Choose Egress
“4”
“4”
![Page 6: Queuing and Queue Management - Computer Science … · Queuing and Queue Management ... Detecon (of congeson) ... Fabric Processor Line card Line card Line card Line card data plane](https://reader031.fdocuments.us/reader031/viewer/2022021501/5ac14e237f8b9a357e8c81ea/html5/thumbnails/6.jpg)
RouterDesignIssues
• Schedulingdiscipline – Whichpackettosend?
– Someno1onoffairness?Priority?
• Droppolicy– Whenshouldyoudiscardapacket?– Whichpackettodiscard?
• Needtobalancethroughputanddelay– Hugebuffersminimizedrops,butaddtoqueuingdelay(thushigherRTT,longerslowstart,…)
6
![Page 7: Queuing and Queue Management - Computer Science … · Queuing and Queue Management ... Detecon (of congeson) ... Fabric Processor Line card Line card Line card Line card data plane](https://reader031.fdocuments.us/reader031/viewer/2022021501/5ac14e237f8b9a357e8c81ea/html5/thumbnails/7.jpg)
FIFOSchedulingandDrop‐Tail• Accesstothebandwidth:first‐infirst‐outqueue
– Packetsonlydifferen1atedwhentheyarrive
• Accesstothebufferspace:drop‐tailqueuing– Ifthequeueisfull,droptheincomingpacket
7
✗
![Page 8: Queuing and Queue Management - Computer Science … · Queuing and Queue Management ... Detecon (of congeson) ... Fabric Processor Line card Line card Line card Line card data plane](https://reader031.fdocuments.us/reader031/viewer/2022021501/5ac14e237f8b9a357e8c81ea/html5/thumbnails/8.jpg)
Problemswithtaildrop
• Understablecondi1ons,queuealmostalwaysfull– Leadstohighlatencyforalltraffic
• Possiblyunfairforflowswithsmallwindows– Largerflowsmayfastretransmit(detec1nglossthroughTripDupACKs),smallflowsmayhavetowaitfor1meout
• Windowsynchroniza1on– Moreonthislater…
8
✗
![Page 9: Queuing and Queue Management - Computer Science … · Queuing and Queue Management ... Detecon (of congeson) ... Fabric Processor Line card Line card Line card Line card data plane](https://reader031.fdocuments.us/reader031/viewer/2022021501/5ac14e237f8b9a357e8c81ea/html5/thumbnails/9.jpg)
SchedulingPolicies
(Weighted)FairQueuing(andClass‐basedQualityofService)
9
![Page 10: Queuing and Queue Management - Computer Science … · Queuing and Queue Management ... Detecon (of congeson) ... Fabric Processor Line card Line card Line card Line card data plane](https://reader031.fdocuments.us/reader031/viewer/2022021501/5ac14e237f8b9a357e8c81ea/html5/thumbnails/10.jpg)
FairQueuing(FQ)• Maintainsseparatequeueperflow
• Ensuresnoflowconsumesmorethanits1/nshare– Varia1on:weightedfairqueuing(WFQ)
• Ifallpacketsweresamelength,wouldbeeasy
• Ifnon‐work‐conserving(resourcescangoidle),alsowouldbeeasy,yetloweru1liza1on
10
RoundRobinService
Egress Link
Flow 1
Flow 2
Flow 3
Flow 4
![Page 11: Queuing and Queue Management - Computer Science … · Queuing and Queue Management ... Detecon (of congeson) ... Fabric Processor Line card Line card Line card Line card data plane](https://reader031.fdocuments.us/reader031/viewer/2022021501/5ac14e237f8b9a357e8c81ea/html5/thumbnails/11.jpg)
FairQueuingBasics
• Trackhowmuch1meeachflowhasusedlink
– Compute1meusedifittransmitsnextpacket
• Sendpacketfromflowthatwillhavelowestuseifittransmits– Whynotflowwithsmallestusesofar?
– Becausenextpacketmaybehuge!
11
![Page 12: Queuing and Queue Management - Computer Science … · Queuing and Queue Management ... Detecon (of congeson) ... Fabric Processor Line card Line card Line card Line card data plane](https://reader031.fdocuments.us/reader031/viewer/2022021501/5ac14e237f8b9a357e8c81ea/html5/thumbnails/12.jpg)
FQAlgorithm
• Imagineclock1ckperbit,thentx1me~length
Finish1meFi=max(Fi‐1,Arrive1meAi)+LengthPi
• Calculatees1matedFiforallqueuedpackets
• TransmitpacketwithlowestFinext
12
![Page 13: Queuing and Queue Management - Computer Science … · Queuing and Queue Management ... Detecon (of congeson) ... Fabric Processor Line card Line card Line card Line card data plane](https://reader031.fdocuments.us/reader031/viewer/2022021501/5ac14e237f8b9a357e8c81ea/html5/thumbnails/13.jpg)
FQAlgorithm(2)
• Problem:Can’tpreemptcurrenttxpacket
• Result:Inac1veflows(Ai>Fi‐1)arepenalized– Standardalgorithmconsidersnohistory
– Eachflowgetsfairshareonlywhenpacketsqueued
13
![Page 14: Queuing and Queue Management - Computer Science … · Queuing and Queue Management ... Detecon (of congeson) ... Fabric Processor Line card Line card Line card Line card data plane](https://reader031.fdocuments.us/reader031/viewer/2022021501/5ac14e237f8b9a357e8c81ea/html5/thumbnails/14.jpg)
FQAlgorithm(3)
• Approach:givemorepromptnesstoflowsu1lizinglessbandwidthhistorically
• BidBi=max(Fi‐1,Ai–δ)+Pi– Intui1on:withlargerδ,schedulingdecisionscalculatedbylasttx1meFi‐1morefrequently,thuspreferringslowerflows
• FQachievesmax‐minfairness– Firstpriority:maximizetheminimumrateofanyac1veflows
– Secondpriority:maximizethesecondminrate,etc.
14
![Page 15: Queuing and Queue Management - Computer Science … · Queuing and Queue Management ... Detecon (of congeson) ... Fabric Processor Line card Line card Line card Line card data plane](https://reader031.fdocuments.us/reader031/viewer/2022021501/5ac14e237f8b9a357e8c81ea/html5/thumbnails/15.jpg)
Usesof(W)FQ
• Scalability– #queuesmustbeequalto#flows
– But,canbeusedonedgerouters,lowspeedlinks,orsharedendhosts
• (W)FQcanbeforclassesoftraffic,notjustflows– UseIPTOSbitstomark“importance”
– Partof“Differen1atedServices”architecturefor“Quality‐of‐Service”(QoS)
15
![Page 16: Queuing and Queue Management - Computer Science … · Queuing and Queue Management ... Detecon (of congeson) ... Fabric Processor Line card Line card Line card Line card data plane](https://reader031.fdocuments.us/reader031/viewer/2022021501/5ac14e237f8b9a357e8c81ea/html5/thumbnails/16.jpg)
DropPolicy
DropTailRandomEarlyDetec1on(RED)
ExplicitConges1onNo1fica1on(ECN)
16
![Page 17: Queuing and Queue Management - Computer Science … · Queuing and Queue Management ... Detecon (of congeson) ... Fabric Processor Line card Line card Line card Line card data plane](https://reader031.fdocuments.us/reader031/viewer/2022021501/5ac14e237f8b9a357e8c81ea/html5/thumbnails/17.jpg)
BurstyLossFromDrop‐TailQueuing
• TCPdependsonpacketloss– Packetlossisindica1onofconges1on– AndTCPdrivesnetworkintolossbyaddi1verateincrease
• Drop‐tailqueuingleadstoburstyloss– Iflinkiscongested,manypacketsencounterfullqueue– Thus,losssynchroniza1on:
• Manyflowsloseoneormorepackets• Inresponse,manyflowsdividesendingrateinhalf
17
![Page 18: Queuing and Queue Management - Computer Science … · Queuing and Queue Management ... Detecon (of congeson) ... Fabric Processor Line card Line card Line card Line card data plane](https://reader031.fdocuments.us/reader031/viewer/2022021501/5ac14e237f8b9a357e8c81ea/html5/thumbnails/18.jpg)
SlowFeedbackfromDropTail• Feedbackcomeswhenbufferiscompletelyfull
– …eventhoughthebufferhasbeenfillingforawhile
• Plus,thefillingbufferisincreasingRTT– …makingdetec1onevenslower
• MightbebeEertogiveearlyfeedback– Andget1‐2connec1onstoslowdownbeforeit’stoolate
18
![Page 19: Queuing and Queue Management - Computer Science … · Queuing and Queue Management ... Detecon (of congeson) ... Fabric Processor Line card Line card Line card Line card data plane](https://reader031.fdocuments.us/reader031/viewer/2022021501/5ac14e237f8b9a357e8c81ea/html5/thumbnails/19.jpg)
RandomEarlyDetec1on(RED)• BasicideaofRED
– Routerno1cesthatqueueisgesngbacklogged– …andrandomlydropspacketstosignalconges1on
• Packetdropprobability– Dropprobabilityincreasesasqueuelengthincreases– Else,setdropprobabilityasfunc1onofavgqueuelengthand1mesincelastdrop
19
Average Queue Length
Dro
p Pr
obab
ility
0
1
![Page 20: Queuing and Queue Management - Computer Science … · Queuing and Queue Management ... Detecon (of congeson) ... Fabric Processor Line card Line card Line card Line card data plane](https://reader031.fdocuments.us/reader031/viewer/2022021501/5ac14e237f8b9a357e8c81ea/html5/thumbnails/20.jpg)
Proper1esofRED• Dropspacketsbeforequeueisfull
– Inthehopeofreducingtheratesofsomeflows
• Dropspacketinpropor1ontoeachflow’srate– High‐rateflowshavemorepackets– …and,hence,ahigherchanceofbeingselected
• Dropsarespacedoutin1me– WhichshouldhelpdesynchronizetheTCPsenders
• Tolerantofburs1nessinthetraffic– Bybasingthedecisionsonaveragequeuelength
20
![Page 21: Queuing and Queue Management - Computer Science … · Queuing and Queue Management ... Detecon (of congeson) ... Fabric Processor Line card Line card Line card Line card data plane](https://reader031.fdocuments.us/reader031/viewer/2022021501/5ac14e237f8b9a357e8c81ea/html5/thumbnails/21.jpg)
ProblemsWithRED• Hardtogettunableparametersjustright
– Howearlytostartdroppingpackets?– Whatslopeforincreaseindropprobability?– What1mescaleforaveragingqueuelength?
• REDhasmixedadop1oninprac1ce– Ifparametersaren’tsetright,REDdoesn’thelp– Hardtoknowhowtosettheparameters
• Manyothervaria1onsinresearchcommunity– Nameslike“Blue”(self‐tuning),“FRED”…
21
![Page 22: Queuing and Queue Management - Computer Science … · Queuing and Queue Management ... Detecon (of congeson) ... Fabric Processor Line card Line card Line card Line card data plane](https://reader031.fdocuments.us/reader031/viewer/2022021501/5ac14e237f8b9a357e8c81ea/html5/thumbnails/22.jpg)
Feedback:Fromlosstono1fica1on
• Earlydroppingofpackets– Good:givesearlyfeedback– Bad:hastodropthepackettogivethefeedback
• ExplicitConges1onNo1fica1on– RoutermarksthepacketwithanECNbit– Sendinghostinterpretsasasignofconges1on
22
![Page 23: Queuing and Queue Management - Computer Science … · Queuing and Queue Management ... Detecon (of congeson) ... Fabric Processor Line card Line card Line card Line card data plane](https://reader031.fdocuments.us/reader031/viewer/2022021501/5ac14e237f8b9a357e8c81ea/html5/thumbnails/23.jpg)
ExplicitConges1onNo1fica1on• Mustbesupportedbyrouter,sender,ANDreceiver
– End‐hostsdetermineifECN‐capableduringTCPhandshake
• ECNinvolvesallthreepar1es(and4headerbits)1. Sendermarks“ECN‐capable”whensending
2. Ifroutersees“ECN‐capable”andexperiencingconges1on,routermarkspacketas“ECNconges1onexperienced”
3. Ifreceiversees“conges1onexperienced”,marks“ECNecho”flaginresponsesun1lconges1onACK’d
4. Ifsendersees“ECNecho”,reducescwndandmarks“conges1onwindowreduced”flaginnextTCPpacket
• WhyextraECNflag?Conges1oncouldhappenineitherdirec1on,wantsendertoreacttoforwarddirec1on
• WhyCRWACK?ECN‐echocouldbelost,butweideallyonlyrespondtoconges1oninforwarddirec1on
23
![Page 24: Queuing and Queue Management - Computer Science … · Queuing and Queue Management ... Detecon (of congeson) ... Fabric Processor Line card Line card Line card Line card data plane](https://reader031.fdocuments.us/reader031/viewer/2022021501/5ac14e237f8b9a357e8c81ea/html5/thumbnails/24.jpg)
OtherTCPMechanisms
Nagle’sAlgorithmandDelayedACK
24
![Page 25: Queuing and Queue Management - Computer Science … · Queuing and Queue Management ... Detecon (of congeson) ... Fabric Processor Line card Line card Line card Line card data plane](https://reader031.fdocuments.us/reader031/viewer/2022021501/5ac14e237f8b9a357e8c81ea/html5/thumbnails/25.jpg)
Nagle’sAlgorithm• Waitiftheamountofdataissmall
– SmallerthanMaximumSegmentSize(MSS)
• Andsomeotherpacketisalreadyinflight– I.e.,s1llawai1ngtheACKsforpreviouspackets
• Thatis,sendatmostonesmallpacketperRTT– …bywai1ngun1lalloutstandingACKshavearrived
• Influenceonperformance– Interac1veapplica1ons:enablesbatchingofbytes– Bulktransfer:transmitsinMSS‐sizedpacketsanyway
25
vs.
ACK
![Page 26: Queuing and Queue Management - Computer Science … · Queuing and Queue Management ... Detecon (of congeson) ... Fabric Processor Line card Line card Line card Line card data plane](https://reader031.fdocuments.us/reader031/viewer/2022021501/5ac14e237f8b9a357e8c81ea/html5/thumbnails/26.jpg)
Nagle’sAlgorithm• Waitiftheamountofdataissmall
– SmallerthanMaximumSegmentSize(MSS)
• Andsomeotherpacketisalreadyinflight– I.e.,s1llawai1ngtheACKsforpreviouspackets
• Thatis,sendatmostonesmallpacketperRTT– …bywai1ngun1lalloutstandingACKshavearrived
• Influenceonperformance– Interac1veapplica1ons:enablesbatchingofbytes– Bulktransfer:transmitsinMSS‐sizedpacketsanyway
26
vs.
ACK
TurningNagleOff void tcp_nodelay (int s) { int n = 1; if (setsockopt (s, IPPROTO_TCP, TCP_NODELAY, (char *) &n, sizeof (n)) < 0) warn ("TCP_NODELAY: %m\n"); }
![Page 27: Queuing and Queue Management - Computer Science … · Queuing and Queue Management ... Detecon (of congeson) ... Fabric Processor Line card Line card Line card Line card data plane](https://reader031.fdocuments.us/reader031/viewer/2022021501/5ac14e237f8b9a357e8c81ea/html5/thumbnails/27.jpg)
Mo1va1onforDelayedACK
• TCPtrafficisotenbidirec1onal– Datatravelinginbothdirec1ons– ACKstravelinginbothdirec1ons
• ACKpacketshavehighoverhead– 40bytesfortheIPheaderandTCPheader– …andzerodatatraffic
• Piggybackingisappealing– HostBcansendanACKtohostA– …aspartofadatapacketfromBtoA
27
![Page 28: Queuing and Queue Management - Computer Science … · Queuing and Queue Management ... Detecon (of congeson) ... Fabric Processor Line card Line card Line card Line card data plane](https://reader031.fdocuments.us/reader031/viewer/2022021501/5ac14e237f8b9a357e8c81ea/html5/thumbnails/28.jpg)
TCPHeaderAllowsPiggybacking
28
Source port Destination port
Sequence number
Acknowledgment
Advertised window HdrLen Flags 0
Checksum Urgent pointer
Options (variable)
Data
Flags: SYN FIN RST PSH URG ACK
![Page 29: Queuing and Queue Management - Computer Science … · Queuing and Queue Management ... Detecon (of congeson) ... Fabric Processor Line card Line card Line card Line card data plane](https://reader031.fdocuments.us/reader031/viewer/2022021501/5ac14e237f8b9a357e8c81ea/html5/thumbnails/29.jpg)
ExampleofPiggybacking29
Data
Data+ACK
Data
A B
ACK
Data
Data + ACK
B has data to send
A has data to send
B doesn’t have data to send
![Page 30: Queuing and Queue Management - Computer Science … · Queuing and Queue Management ... Detecon (of congeson) ... Fabric Processor Line card Line card Line card Line card data plane](https://reader031.fdocuments.us/reader031/viewer/2022021501/5ac14e237f8b9a357e8c81ea/html5/thumbnails/30.jpg)
IncreasingLikelihoodofPiggybacking
• Example:sshorevenHTTP– HostAtypescommand– HostBreceivesandexecutesthecommand
– …andthendataaregenerated– WouldbeniceifBcouldsendtheACKwiththenewdata
• Increasepiggybacking– TCPallowsthereceivertowaittosendtheACK
– …inthehopethatthehostwillhavedatatosend
30
Data
Data+ACK
Data
A B
ACK
Data
Data + ACK
![Page 31: Queuing and Queue Management - Computer Science … · Queuing and Queue Management ... Detecon (of congeson) ... Fabric Processor Line card Line card Line card Line card data plane](https://reader031.fdocuments.us/reader031/viewer/2022021501/5ac14e237f8b9a357e8c81ea/html5/thumbnails/31.jpg)
DelayedACK
• DelaysendinganACK– Uponreceivingapacket,thehostBsetsa1mer
• Typically,200msecor500msec
– IfB’sapplica1ongeneratesdata,goaheadandsend• AndpiggybacktheACKbit
– Ifthe1merexpires,senda(non‐piggybacked)ACK
• Limi1ngthewait– Timerof200msecor500msec– ACKeveryotherfull‐sizedpacket
31
![Page 32: Queuing and Queue Management - Computer Science … · Queuing and Queue Management ... Detecon (of congeson) ... Fabric Processor Line card Line card Line card Line card data plane](https://reader031.fdocuments.us/reader031/viewer/2022021501/5ac14e237f8b9a357e8c81ea/html5/thumbnails/32.jpg)
Conclusions
• Conges1onisinevitable– Internetdoesnotreserveresourcesinadvance– TCPac1velytriestopushtheenvelope– TCPcanreacttoconges1on(mul1plica1vedecrease)
• Ac1veQueueManagementcanfurtherhelp– RandomEarlyDetec1on(RED)– ExplicitConges1onNo1fica1on(ECN)
• Fundamentaltensions– Feedbackfromthenetwork?– Enforcementof“TCPfriendly”behavior?Otherschedulingpolicies(FQ)cangivenstrongerguarantees
32