Queuing and Queue Management - Computer Science and Queue Management ... Detecon (of congeson) ... Fabric Processor Line card Line card Line card Line card data plane control plane

  • View
    215

  • Download
    3

Embed Size (px)

Transcript

  • QueuingandQueueManagementReading:Sec1ons6.2,6.4,6.5

    COS461:ComputerNetworksSpring2011

    MikeFreedmanhEp://www.cs.princeton.edu/courses/archive/spring11/cos461/

    1

  • GoalsofTodaysLecture

    RouterQueuingModelsLimita1onsofFIFOandDropTail

    SchedulingPoliciesFairQueuing

    DroppoliciesRandomEarlyDetec1on(ofconges1on)ExplicitConges1onNo1fica1on(fromrouters)

    Someaddi1onalTCPmechanisms

    2

  • RouterDataandControlPlanes3

    Switching Fabric

    Processor

    Line card

    Line card

    Line card

    Line card

    Line card

    Line card

    data plane

    control plane

  • LineCards(InterfaceCards,Adaptors) Interfacing

    Physicallink Switchingfabric

    Packethandling PacketforwardingDecrement1metolive Buffermanagement Linkscheduling Packetfiltering Ratelimi1ng PacketmarkingMeasurement

    4

    to/from link

    to/from switch

    lookup

    Rec

    eive

    Transmit

  • 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

  • RouterDesignIssues

    Schedulingdiscipline Whichpackettosend?Someno1onoffairness?Priority?

    DroppolicyWhenshouldyoudiscardapacket?Whichpackettodiscard?

    NeedtobalancethroughputanddelayHugebuffersminimizedrops,butaddtoqueuingdelay(thushigherRTT,longerslowstart,)

    6

  • FIFOSchedulingandDropTail Accesstothebandwidth:firstinfirstoutqueue

    Packetsonlydifferen1atedwhentheyarrive

    Accesstothebufferspace:droptailqueuing Ifthequeueisfull,droptheincomingpacket

    7

  • Problemswithtaildrop

    Understablecondi1ons,queuealmostalwaysfull Leadstohighlatencyforalltraffic

    Possiblyunfairforflowswithsmallwindows Largerflowsmayfastretransmit(detec1nglossthroughTripDupACKs),smallflowsmayhavetowaitfor1meout

    Windowsynchroniza1onMoreonthislater

    8

  • SchedulingPolicies

    (Weighted)FairQueuing(andClassbasedQualityofService)

    9

  • FairQueuing(FQ) Maintainsseparatequeueperflow Ensuresnoflowconsumesmorethanits1/nshare

    Varia1on:weightedfairqueuing(WFQ) Ifallpacketsweresamelength,wouldbeeasy Ifnonworkconserving(resourcescangoidle),alsowouldbeeasy,yetloweru1liza1on

    10

    RoundRobinService

    Egress Link

    Flow 1

    Flow 2

    Flow 3

    Flow 4

  • FairQueuingBasics

    Trackhowmuch1meeachflowhasusedlinkCompute1meusedifittransmitsnextpacket

    SendpacketfromflowthatwillhavelowestuseifittransmitsWhynotflowwithsmallestusesofar?Becausenextpacketmaybehuge!

    11

  • FQAlgorithm

    Imagineclock1ckperbit,thentx1me~length

    Finish1meFi=max(Fi1,Arrive1meAi)+LengthPi

    Calculatees1matedFiforallqueuedpackets TransmitpacketwithlowestFinext

    12

  • FQAlgorithm(2)

    Problem:Cantpreemptcurrenttxpacket Result:Inac1veflows(Ai>Fi1)arepenalized

    StandardalgorithmconsidersnohistoryEachflowgetsfairshareonlywhenpacketsqueued

    13

  • FQAlgorithm(3)

    Approach:givemorepromptnesstoflowsu1lizinglessbandwidthhistorically

    BidBi=max(Fi1,Ai)+Pi Intui1on:withlarger,schedulingdecisionscalculatedbylasttx1meFi1morefrequently,thuspreferringslowerflows

    FQachievesmaxminfairness Firstpriority:maximizetheminimumrateofanyac1veflows Secondpriority:maximizethesecondminrate,etc.

    14

  • Usesof(W)FQ

    Scalability#queuesmustbeequalto#flowsBut,canbeusedonedgerouters,lowspeedlinks,orsharedendhosts

    (W)FQcanbeforclassesoftraffic,notjustflowsUseIPTOSbitstomarkimportancePartofDifferen1atedServicesarchitectureforQualityofService(QoS)

    15

  • DropPolicy

    DropTailRandomEarlyDetec1on(RED)

    ExplicitConges1onNo1fica1on(ECN)

    16

  • BurstyLossFromDropTailQueuing

    TCPdependsonpacketloss Packetlossisindica1onofconges1onAndTCPdrivesnetworkintolossbyaddi1verateincrease

    Droptailqueuingleadstoburstyloss Iflinkiscongested,manypacketsencounterfullqueue Thus,losssynchroniza1on:

    Manyflowsloseoneormorepackets Inresponse,manyflowsdividesendingrateinhalf

    17

  • SlowFeedbackfromDropTail Feedbackcomeswhenbufferiscompletelyfull

    eventhoughthebufferhasbeenfillingforawhile

    Plus,thefillingbufferisincreasingRTTmakingdetec1onevenslower

    MightbebeEertogiveearlyfeedbackAndget12connec1onstoslowdownbeforeitstoolate

    18

  • RandomEarlyDetec1on(RED) BasicideaofRED

    Routerno1cesthatqueueisgesngbackloggedandrandomlydropspacketstosignalconges1on

    PacketdropprobabilityDropprobabilityincreasesasqueuelengthincreases Else,setdropprobabilityasfunc1onofavgqueuelengthand1mesincelastdrop

    19

    Average Queue Length

    Dro

    p Pr

    obab

    ility

    0

    1

  • Proper1esofRED Dropspacketsbeforequeueisfull

    Inthehopeofreducingtheratesofsomeflows

    Dropspacketinpropor1ontoeachflowsrateHighrateflowshavemorepacketsand,hence,ahigherchanceofbeingselected

    Dropsarespacedoutin1meWhichshouldhelpdesynchronizetheTCPsenders

    Tolerantofburs1nessinthetrafficBybasingthedecisionsonaveragequeuelength

    20

  • ProblemsWithRED Hardtogettunableparametersjustright

    Howearlytostartdroppingpackets?Whatslopeforincreaseindropprobability?What1mescaleforaveragingqueuelength?

    REDhasmixedadop1oninprac1ce Ifparametersarentsetright,REDdoesnthelpHardtoknowhowtosettheparameters

    Manyothervaria1onsinresearchcommunityNameslikeBlue(selftuning),FRED

    21

  • Feedback:Fromlosstono1fica1on

    EarlydroppingofpacketsGood:givesearlyfeedbackBad:hastodropthepackettogivethefeedback

    ExplicitConges1onNo1fica1onRoutermarksthepacketwithanECNbitSendinghostinterpretsasasignofconges1on

    22

  • ExplicitConges1onNo1fica1on Mustbesupportedbyrouter,sender,ANDreceiver

    EndhostsdetermineifECNcapableduringTCPhandshake ECNinvolvesallthreepar1es(and4headerbits)

    1. SendermarksECNcapablewhensending2. IfrouterseesECNcapableandexperiencingconges1on,

    routermarkspacketasECNconges1onexperienced

    3. Ifreceiverseesconges1onexperienced,marksECNechoflaginresponsesun1lconges1onACKd

    4. IfsenderseesECNecho,reducescwndandmarksconges1onwindowreducedflaginnextTCPpacket

    WhyextraECNflag?Conges1oncouldhappenineitherdirec1on,wantsendertoreacttoforwarddirec1on

    WhyCRWACK?ECNechocouldbelost,butweideallyonlyrespondtoconges1oninforwarddirec1on

    23

  • OtherTCPMechanisms

    NaglesAlgorithmandDelayedACK

    24

  • NaglesAlgorithm Waitiftheamountofdataissmall

    SmallerthanMaximumSegmentSize(MSS) Andsomeotherpacketisalreadyinflight

    I.e.,s1llawai1ngtheACKsforpreviouspackets Thatis,sendatmostonesmallpacketperRTT

    bywai1ngun1lalloutstandingACKshavearrived

    Influenceonperformance Interac1veapplica1ons:enablesbatchingofbytesBulktransfer:transmitsinMSSsizedpacketsanyway

    25

    vs.

    ACK

  • NaglesAlgorithm Waitiftheamountofdataissmall

    SmallerthanMaximumSegmentSize(MSS) Andsomeotherpacketisalreadyinflight

    I.e.,s1llawai1ngtheACKsforpreviouspackets Thatis,sendatmostonesmallpacketperRTT

    bywai1ngun1lalloutstandingACKshavearrived

    Influenceonperformance Interac1veapplica1ons:enablesbatchingofbytesBulktransfer:transmitsinMSSsizedpacketsanyway

    26

    vs.

    ACK

    TurningNagleOffvoid tcp_nodelay (int s) {

    int n = 1;

    if (setsockopt (s, IPPROTO_TCP, TCP_NODELAY,

    (char *) &n, sizeof (n)) < 0) warn ("TCP_NODELAY: %m\n"); }

  • Mo1va1onforDelayedACK

    TCPtrafficisotenbidirec1onalDatatravelinginbothdirec1onsACKstravelinginbothdirec1ons

    ACKpacketshavehighoverhead40bytesfortheIPheaderandTCPheaderandzerodatatraffic

    PiggybackingisappealingHostBcansendanACKtohostAaspartofadatapacketfromBtoA

    27

  • 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

  • ExampleofPiggybacking29

    Data

    Data+ACK

    Data

    A B

    ACK

    Data

    Data + ACK

    B has data to send

    A has data to send

    B doesnt have data to send

  • IncreasingLikelihoodofPiggybacking

    Example:sshorevenHTTPHostAtypescommandHostBreceivesandexecutesthecommand

    andthendataaregeneratedWouldbeniceifBcouldsendtheACKwiththenewdata

    Increasepiggybacking TCPallowsthereceivertowaittosendtheACK

    inthehopethatthehostwillhavedatatosend

    30

    Data

    Data+ACK

    Data

    A B

    ACK

    Data

    Data + ACK

  • DelayedACK

    DelaysendinganACKUponreceivingapacket,thehostBsetsa1mer

    Typically,200msecor500msec IfBsapplica1ongeneratesdata,goaheadandsend

    AndpiggybacktheACKbit Ifthe1merexpires,senda(nonpiggybacked)ACK

    Limi1ngthewaitTimerof200msecor500msecACKeveryotherfullsizedpacket

    31

  • Conclusions

    Conges1onisinevitable Internetdoesnotreserveresourcesinadvance TCPac1velytriestopushtheenvelope TCPcanreac