Top Banner

of 9

86 Timer

May 30, 2018

Download

Documents

Start123456
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
  • 8/14/2019 86 Timer

    1/9

    Why TCP Timers Dont Work Well

    Lixia ZhangLaboratory for Computer ScienceMassachusetts Institute of TechnologyCambridge, MA 02139

    AbstractR.epeated observation of TCP retransmission timer problemsstimulated investigation into the roles and limitations oftimers. Timers are indispensable tools in building up reliabledistributed systems. However, as the experience with the TCPretransmission timer has shown, timers have intrinsiclimitations in offering optimal performance. Any timeoutbased action is a guess based on incomplete information, andas such is bound to be non-optimal. We conclude that, if weaim at high performance, we should use external events as afirst line of defense against fa ilures, and depend on timers onlyin cases where external notification has failed.

    1. OverviewIn computer commui~icatioi~ networks a tiinzey is a

    failure detection mechanism, normally used to decidewhen to retransmit a lost packet, or when to abandon abroken connection. Timers have been employed in allnetwork protocols that offer reliable services. They seemto play an indispensable role. However, even with manyyears of experience. we are still not able to make timerswork as well as we would like.

    The Transmission Control Protocol (TCP) [8] isintended for use as a highly reliable host-to-hos t protocolin packet-switched c0111pute1 networks, and ill

    Permission to copy without fee all or part of this material 1sgrantedprovided that the copies are not made or distributed for directcommercial advantage, the ACM copyright notice and the title ofthe publication and its date appear, and notice is given that copyingis by permission of the Association for Computing Machinery. TOcopy otherwise, or to republish, requires a fee and/or speckpermission.

    interconnected systems of such networks. TCP has beenwidely implemented and used over the years. Repeatedobservations of TCP timer problems stimulated ourinvestigation into further understanding of the followingquestions:

    l Is a timer really indispensable in networkprotocols?0 What roles should a timer play? What areits limitations?l How should we use it?The basic conclusions we draw are that timers are

    indispensable in building reliable distributed systems; yettheir limitations need to be fully identified. Illretrospect, we see that many of the problemsencountered in using a timer are in fact due toillisuiiderstantling of its limitations. Although thefollowing discussions relate specifically to phenomenaand problems occurring in TCP, the conclusions. webelieve, apply to the roles of timers in similar protocols,sLlcll as the IS0 Transport Protocol, a.nd in alldistributed systems.

    The nest, section espla.ins the necessity of timers iiidisti~il~nt.ed systems in general, and in network protocolsin particular. Section 3 is a review of previous work andrspcrience will1 TCP timer. Section 4 explores theintrinsic liinitatious of a timer. With a betterunderstanding of the limitations, section 5 suggests somehellristic rules in using timers, and loses the timinga.lgorithm of NETBLT (NETwork BLock Transfer) [z], aIJIIII; data transfrr protocol, to give au esi~tnple. Thelast section is a suinmary of the 1vot.k.

    0 1986 ACM o-89791-201 -2/86/0800-0397 7% 397

  • 8/14/2019 86 Timer

    2/9

    2. Why a Timer?A computer net,work is a distributed system. One of

    the advantages of distributed systems is that there is noi&e-slaa~ing among individual autonomous componentsin the system, i.e. they fail independently. This non-fate-sharing feature is achieved by coupling thecomponents on ly through data communications channels.Consequently, individual components in a distributedsystem can only hear from each other through thecommunication channels, but cannot directly observe theexistence or functioning of others and their runningstates. To coordinate with each other, they have twoways to detect esteIxa1 state changes or failures:

    1. By external reports. For instances, upon thearrival of an ackno~vledgment, the datasender knows that the data sent have beensuccesslully received; when an ARPANEThost tries to communicate with another not-running host, the network will respond witha remote host dead message.

    2. By local detection, e.g. using a retransmissiontimer to detect packet losses.

    In this paper fk/w?.e has a very general definition: itmay simply refer to the failure of an intended function,as well as to a machine crash or the breaking of acommunication channel. Later on we will see thatexterna.1 reports are a better way to do failure detectionand recovery. For the following reasons, however, localdetection is alwa.ys needed:

    . Not all external changes or failures can bereported. For esmiple, if a receiver detectsan incoming packet with a header checksumerror, the source address part may have beendamaged, hence the sender cannot beidentified. The receiver will not be able tonotify the sender to retransmit the packet.

    l The reporting system may fail itself, e.g. anacl~iio~vleclgment may get lost.Therefore, to xhieve sufficient self-protection in adistributed system, cautious users set up some form o flocal detection. So far, the only local detection toolavailable is a timer. This is not a coincidence. With noexternal information, tim.e is the only tool that one canuse to estinzate external state changes. If onecommunicating end does not hear from the other end asit should within some reasonably long time period, itclSsu?nes that something must have gone wrong, eitherwithin the communication network or at the remote site.

    For example, the sending host of a TCP connection usesa timer to detect packet loss, so does an ARPANETIMP; during the absence of data traffic, ARPANETIMPS regularly talk to each other. and a. neighbor IMPwill be declared clown if it has been silent for a certaintime period. A timer is a ?nust for any player in adistributed system.3. Previous Experience and Work with

    TCP TimerA timer is an alarm clock which goes off after a

    specified timeout period. The usual goal of a timeralgorithm is to dynamically adjust the timeout value toapproach an ideal where the timer is triggeredkmntedicite ly and only upon a real failure. In theirdesire to achieve good performance, all timer algorithmstry to balance between two conflicting goals:

    1. speeding up failure detection, and2. minimizing false alarms, i.e. minimizing the

    incidents of the timer going off prematurelywhen no real failure has occurred.TCP uses timers to detect packet losses (the

    retransmission timer) and connection breaks (the deathtimer). Since connection breaks happen rarely, andhosts usually are willing to try fo r a long time beforefinally giving up. the death timer is often set to a largevalue. This is not the case, however, for TCPretransmission timers. In the middle of a session, it isundesirable for a client to wait for a few minutes torecover a transmission error. TCP took the approach ofsetting the retransmission time] by dynamicallyestimating the Round Tkp Time (RTT) between the twocommunicating entities. In this section we firstint,roduce the TCPs adaptive retransmission timeralgorithm, then discuss its problems.

    3.1. TCP Retransmission Timer AlgorithmDue to the variability of the networks that compose

    an internetwork system, the TCP retransmission timer(TCP timer for short) is determined dynamically foleach connection. TCP measures the RTT for each datasegment transfer, and computes a Smoothed Round TripTime (SRTT):

    SRlT= a x SRTT+ (1 - a) x RTTBased on SRTT, it then computes the Ret,ransmissio,nTimeOut value (RTO):

    RTO = nrin { UDou~nd, mnz (Lbomd, p x SRTT) }Where iY6omd and Lbwtzd a.re the upper and lower

    398

  • 8/14/2019 86 Timer

    3/9

    bounds on the tinieout value; 0 is a smootliing factor,and /? is a variance factor. In real implementstioi7s,1Jbound and Lbound values are assigned cmpiricaily as aloose limitation on the timers value. Recommendedvalues of a and p are 0.8 - 0.0, and 1.3 - 2,respectively. Different Q and p values have beenexperimented with, as descril,ed below.

    3.2. Problems with TCP timerOver the years of running TCP in the ARPA

    Internet, many problems associated ~vith the TCP timerhave been encountered. Understanding them requiresthat we understand the running environment of TCP.The ARPA Internet is a hcterogeneoils netwolk complexwhich connects together a large number of diversenetworks: high speed LAW, narrow bandwidth dialuplines, loug delay satellite channels, reliable long haulnetworks, etc.. with the communica tiou bandwidths anddelays varying between networks by orders ofmagnitude. The data carrier over this complex is IP [O],a datagram protocol offering a best effort, but notreliable, delivery service. Packet loss is not uncoinii7on,especially when the network gets heavily loaded, becauseIPs only defensive tool is di~oppiiig packets, relying onIhe end-to-end transport protocols to recover the losswl~en necesswy. TCP runs on top of II. TCP does nothave a negative-acliiio~vleclgii~eiit mecliaiiism to reporttransmission errors; all clata errors, including losses, relyon the senders retransmission timer to triggel therecovery. Such an environnieiit makes an accuratesetting of the TCP timer necessary for goodperform mce.

    The lkst difficulty in using the TCP timer is tochoose an init,ial value for t:llc SRTT. l3efore the firstdata exchange belween Ilic Tao comniunicating entities.there is no information available t,o the sender as to howlong the round trip time will be, assuming therlcstination address does not convey network topologicalimplications. The current approach is to pick anarbitrary value, say 3 seconds, in the hope that it willquickly converge to the right value through the adaptivealgorithm. It is often the case that this arbitrarilychosen value is too small, or too large, compared to theround trip time of the intended connect,ion; so will bethe initial RTO value. As a result, TCP w ill eitherretransmit superfluously, or wait, for a long time beforeretransmitting if the first packet is lost. Also. theconvergence is slow. 1Vhcn the initial value is toosmall, escessive retransinissions may cause a temporary

    network congestion before the timer gets a chance toconverge to the correct value. This problem has beenobserved many times in the ARPA Iuternet. On theother band, a large initial value means a possible slowstart to the client, but does no damage to the network asa whole otherwise.

    A second problem is how to measure the round triptime. This measurement is, of course, trivial when thereis no packet loss. When packet losses occur, however,getting correct RTT measurements is impossible, becausewhen a11 acki~o~vletlgmeiit is received after nl.et,~ansmissions, the data sender ca,nnot tell which of then+l copies sent is being acl~nowledged. This problemdirectly affects the computation result of the SRTTvalue. A case analysis due to Dave Clark (see Appendis-I) shows that TCP cannot compute the SRTT valuecorrectly when packet retransmission occurs. Since theSRTT is used solely for packet loss recovery purposes,this problem is particularly unfortunate: the SRTT isuot used mhen there is no loss; when it is to be used, itcannot, be correct.

    The nest, problem in using the TCP timer is how toset RTO values. ~Vrong SR.TT values 1ea.d to wrongRTO values. When the RTO is (,oo small, the effectivenetwork throughput is rcducccl by too many duplica.tepackets. When the RTO is too large, network clientssllffer from needless long waits before retransmitting lostpaclteh. Most TCP implclnentations, as well ELS heTCP experiment discussed shortly. measure the RTTfrom t,lx first sending. \\lien tlw iiet\vork is lightlyloaded, packet loss is random and negligible, occasionalinaccurate RTT measurements do not cause a bigproblem, because the SRTT value gradually approachesLhe true round trill t:inie despite some inomentnryfluct~uat ion, and because retransmissions are rare, sousing a larger t.1~1 needed RTO value does not degracleperformance noticeably. However, when network

    399

  • 8/14/2019 86 Timer

    4/9

    congestion occurs, packet losses tend to be frequent,which in turn causes the SRTT and hence the RTO togrow rapitlly. This phenonienoli x33 olx5erved in anetmorlr test conducted at hIIT-KS: data packets xvereXlllI fro111 one host, 011 l LO hlbps rin;Snct. to another h0stOtt a 10 Albps l3tlteri1cl~ though a gateway. The packetflood congested the gat exva.y, causing many packels to bedropped. The RTO va.lue grew quickly from severalhundred niilli-seconds to inore t1la.n 2 minutes, causingthe sender to wait to0 long before initia.ting the recovery.The same plieiiomenoii was a.lso observed in a networkexperinlent al, Digital Equipment Corporation [S].

    Even assuming the SRTT value is a correct averageof the round trip time, setting an accurate RTO valuebased on the SRTT is still c lifficult, due to thepotentially large variance of the RTT. One source ofthe variance comes from the packet length effect,.\Vlienever there are one or more narrow bandwidthchannels on the route of a connection, the doininant,component in the RTT will be the hit transfer delayover that line, which is pi~oport.ioiial t.0 the packet!length. Packet lengths can easily vary by a factor large1than two, causing false timeouts. Another source isdynainic network routing: since IP is a datagrainprotocol, packets may theoretically be routed throughdifferent paths with different clelays. Still anothet* one isthe delay at t,he tweivitig host: besides its packet])rocessing delay, the host, f01- perfotmln.tlceco~~siderations, may prefer not to respond immediatelyafter every packet arrival [I], contributing another facto]to the RTT variance.

    The above a.rguments show that the variance ofnetwork delay can easily go alcove the recommendedvalue. 1.3 - 2. of the variance factor j3, even withoutconsidering the effect of the 11et1v0r1< trafficfluctuations). Slill another difficulty iii setting anaccurak RTO 121~ is the ineYital>le phase de1a.ybetween the meas~lrccl RTT ValuPs and Lhe currentsrountl trip time inside tile nrt,nork. A sudden change inpath or 1letTVO~li condition. say at time T,, can result ina sudden increase in the round trip time. Packets sentafter T o x.ill hear a longer cIFIR~-,say of D seconds. Themcasllretl RTT vallle. ho\vever. does not, reflect thischat~gc ttttt.il t.ime To + I>. The \rallie of D can be s3era.lsecolltls, or evei) t.ens of sccontls, on a. long path.Reflecting the change to (he RTO setting t&es evenlolygcr \vllen a I.)ig CLvalue is used. It was observed iii anct,T\.orl; siniulntitsn that. during this time period, the

    tinier frequently went off and triggered superfluousretrwnsmissions [lo].

    The last prol~lcm in using TCP timer is how tohandle a timeout. If the TCP timer on anunaclinowledged data segment S goes off, TCPimplemenlatioiis mere ~econimended to retransmit onlythe packet containing S, not any subsequent packetsthat may be awaiting acl;iiolr:ledgment. In the t3ea.lworld, many possible events may result in a TCP time1going off when retransmission is unnecessary 01infeasible. Consider the following cases:

    1. S may not have left the host yet because ofsome locliup at lower layer. For example, theinterface to the attached network is blocked.

    1. The current, timer value may be shorter thanthe fluctuatiig 1*0uritl trip time a.t thatmoment, causing a false alarm, e.g. a packetsurge at some gath3va.y made S have a mu&longer round trip time.

    3. s TV .5 received correctly blltacl~nowledgment was damaged or lost.its

    4. S was dropped by s0me gateway due tocongestion.

    5. S wh5 tlr0ppeci due to transmission channelerror.6. The network parlil,ioned or the destination

    host crashed.In Llie Eit3t three cases, retransmission is unnecessary.Even fo r the nest one. which does require retransmission,1 ie existence of congestion implies care sl~onlcl be takennot to worsen the situxLion further. An immediate

    400

  • 8/14/2019 86 Timer

    5/9

  • 8/14/2019 86 Timer

    6/9

  • 8/14/2019 86 Timer

    7/9

    5. A Better Way to use Timers

    5.1. Heuristic RulesSince we have to pay the price of non-optimal

    lxrforniance \vhcnwer using a timer. the first, advice inusi11g ti1ner.s is to rely OE tllem as little as possible. Thisineaiis t,hat, ilny al~no~mnl situation should Ix resohrd ifJ)ossiI:)le, rather t,ha1I t.uriiing it, to a. failure too easilyand m l>-ing 011 timers to tw0~e1~. and thiit, any failureslio~~ltl he explicit I\ reJ>ortcd if possible. EsternalIe]>OrLS ill? IK)Lll fklSt$l. RllCl IllON! ZKPl.l~atC tll~~ll uuing >llimer in faililre detect,io ii.

    Secondly, Lry Lo get. more in~orniatioii to help set 3proper t.imcoutb value. mid do not al~tmiipt, to tighten thetAnier for a I.wtt~er perforniailce, unless it is lxwxl onthe linomleclge of tile u1iclcrlyii~g system, because thegain in occasio1d faster detection by a tight timer maywell he smaller than the loss due to false alams.

    i\ccept8i1ig the fact that the timer should be setloosely. if it, is not feasil~lc to wast,e the time whenwaiting for eit,lier a, confimat~ioii or 5 timeout, one 7va;yto improve the Jw2rforniance is Co explore moreconci.wmicy l>;\T applyin g t,Jic ki~on~leclge of the specificapJ,lications.

    5.2. An ExampleHere we use WETBLT [?I .:\ an eseniple to show aI)et.Ler \\-ay to use t,inlers. KJYLXLT was designed as a

    l)ulk data tr2iilsfer protocol at h,lJT-LCS. It, hrts a.chieved\:er> good Jmfolm RIl(f clllring t,lie J~reIiminaryi in~~lciiient.ation trst.. hlrrc~ lests are get to be performedover a wick range of iietwork c0nclitioiis. however. Thereader sliould J)e warned, therefore, that the followingtlixnssions are more based 011 so~r1icl arguments than onxtiial experience.

    WETJ3J,T is >ln0t,he~ tjranspol% level protoco l designcclfor transferring large cJantit.ies of data across theinternetS. Like TCP, it, wes a t,imer t,o detect packet loss,Ijut, its data transmission l,imiiig scheme is clrasticallydifferent, from TCPs. The four IllRjOl dilfereiices areclesci~il~etl I)elo~v.

    First, NETBLT sets t,hr rct~msmissim timer at, therecei\Giig end, rather than at the sender as TCF does.\Vhen considering the state of a tla.ta transfer. it is thereceiver that is more coucemetl with the transfer results.and thii t, know the st.nt,e changes (co rrect reception oflIC\\ clsta) first,.

    Swontl. NEIRJ2T sets a I.c,t~i.iinsinission timer on eachI)lOclc 0P data, which COilLaillS a large number of packet,s,instead of t.iniiiig ea.ch pncliel. This allows the timeout,lxiue to J)e set more loosely to avoid false alarms, anddill SawS a lot of wiiting time, because at worst theremi\-cl. wait.S only oiicc t.0 initia.Le the recovery cycle foiall packet losses in R block of data. Additio1mAg, framan iiiiplcn~rlilatio1i poinl. of view, setting and cancelingof Limers are espensive opem.Lions in all systems; settingfewer t~imcrs certainly sa.ves system overlieacl.

    ThirtJl!r, in case of packet loss, NETBLT does not\\ait, for the t.inicout to t.riggcr the recovery. Iiisteacl, as50011 as lhe last. packet, in a blOCI< ill.l.i\TS. tlir receive rwill check to bee if any- pacliet,S are missing: if so, it,dallies for a shrt~ time pcriotl (lo ~vait. for J>ossiJ>leout.-of-order packets) and t him informs the wnclcr with il lislor itll missing paclutSed~l~0111 IIE t.ranslcr speed or I,llC scntler. latllcr than t.hcI~~cm~lKYJ llctwol~k Ckli1.I~. LTpon rcceiVii1g the firstpacket, of a, J~locJ;, the iwei\-er sLwts the timer with tlwItTO vallte equal to t.lre amount of time required tot,~.andw tlie whole J)locl; of data (this time can becomput~ecl fro1n t,he l.~locli length antI the Sciirle~~s Sped),plils a 7.ariat.ion margin. Tlleref0t.e tlie tinier does notP,, fcr lnm the RIY 1nr~s11renleellt errors. Al30, as nsitlr effect, of tiiiiing au entire hlocli o f data. cle1a.v\-ariances 011 iildivid~li~l J)acliet,s in llir wiiie block arelikely t.0 cancel ont, hcncc a modcrate variance value isrspwtctl to Ix sl1fficicnt.

    403

  • 8/14/2019 86 Timer

    8/9

  • 8/14/2019 86 Timer

    9/9

    2. If the RTT is measured from sending the lastcopy to receiving the acknowledgment, theresult will be a smaller value than the realround trip time, if an earlier than the lastretransmitted COPY triggered theacknowledgment. The SRTT will thenconverge to wrong values. Consider thefollowing example: if the true RTT is 11seconds, but the RTO was wrongly set to 10seconds, the packet is then retransmitted

    I l5 10 Packets transmittedCase2: SRTTConvergcs toawrongvalue.after 10 seconds, and the RTT measurementreturns 1 second when the acknowledgmentto the first Packet is received.

    3. If the measured RTT is not used to adjustthe SRTT when retransmissions occur, theSRTT will not change. If the original RTOis shorter than the real round trip time or thenetwork delay has suddenly increased (e.g.because of route change), the RTO will stickat the small value, resulting in unnecessarilyretransmitting every packet.

    Case 3: SRTT stays t the wrongvalue Packets transmitted

    References111 Da.vid Clark.\Vintlow and t\cl~no~\~letl~:1~~e~lt tralegy in TCP.ARPA RFC-813.

    1082PI David Clark, h4ark Lambert, & Lisia Zhang.NETBLT: A Rulk Data Transfer Protocol.ARPA RFC-WI).December. 108.5

    ckorL'rcy Cooper.A New Timillg Algnrilhni for Transmission nnd

    Retransmission in IFTP.ii working paper dra.Pl, written a.t ComputerSystem Research group, MIT-LCS.1083

    SLel)hen Mr. Edge.An Adaptive TimeoilL Algorithm forReLransmission Across a Packet SwitchingNet\vork.

    David L. Milk.

    .I. lostel.DOD Standilrd Tra.nsmission Control Protocol.ARl>r\ RIC-x3.8Cl)l elnlxr. 1m I

    J. Postcl.DOD St.mltlalYl IntdTnet Pl~ot,ocol.=\Rl=\ RlC:-791,SeptemIK!r~, ISIS1

    Lisin. %Ililll!&.iVel~wo1~1c Siinlllat.iori Rcpo~t.\Vorliing paper in progress.This report summarizes test. results on IP so1Irce

    r~uench hantlli~~g and TCP timer problems.The simulator wa.rc built, I,y the au tlior a.th,L[T-LCS to stlttlY net\vork congestion controlproblems. It25 ,opology imitates the conditionsin the current Al?I-4 Internet, i.e. the delay2nd bantl7vidl.h charncteri.stics ofc0111n1lnicalion cl~annels differ by orders ofmagnil;urlr. The dat.a. ~.raffic gcncrator modelstwo l,!-l)es of ilpplicxtion s: file tramfer ant1Ixmiole login.

    405