⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 rfc813.txt

📁 RFC 相关的技术文档
💻 TXT
📖 第 1 页 / 共 3 页
字号:
RFC:  813                              WINDOW AND ACKNOWLEDGEMENT STRATEGY IN TCP                             David D. Clark                  MIT Laboratory for Computer Science               Computer Systems and Communications Group                               July, 1982     1.  Introduction     This  document describes implementation strategies to deal with twomechanisms in TCP, the window and the acknowledgement.  These mechanismsare described in the specification document, but it is  possible,  whilecomplying with the specification, to produce implementations which yieldvery  bad  performance.    Happily,  the pitfalls possible in window andacknowledgement strategies are very easy to avoid.     It is a much more difficult exercise to verify the performance of aspecification than the correctness.  Certainly, we have less  experiencein  this  area,  and  we  certainly  lack  any  useful formal technique.Nonetheless, it is important to attempt a specification  in  this  area,because  different  implementors  might  otherwise  choose superficiallyreasonable algorithms  which  interact  poorly  with  each  other.  Thisdocument  presents  a  particular  set of algorithms which have receivedtesting in the field, and which appear to work properly with each other.With more experience, these algorithms may become  part  of  the  formalspecification:  until such time their use is recommended.                                   22.  The Mechanisms     The acknowledgement mechanism is at the heart of TCP.  Very simply,when  data  arrives at the recipient, the protocol requires that it sendback an acknowledgement of this data.  The protocol specifies  that  thebytes  of  data  are  sequentially  numbered,  so that the recipient canacknowledge data by naming the highest numbered  byte  of  data  it  hasreceived,  which  also  acknowledges  the  previous  bytes (actually, itidentifies the first byte of data which it has  not  yet  received,  butthis is a small detail).  The protocol contains only a general assertionthat  data  should  be acknowledged promptly, but gives no more specificindication as to how quickly an acknowledgement must  be  sent,  or  howmuch data should be acknowledged in each separate acknowledgement.     The window mechanism is a flow control tool.  Whenever appropriate,the  recipient of data returns to the sender a number, which is (more orless) the size of the buffer which the receiver currently has  availablefor  additional  data.   This number of bytes, called the window, is themaximum which the sender is permitted to  transmit  until  the  receiverreturns  some  additional  window.  Sometimes, the receiver will have nobuffer space available, and will return a window value of zero.    Underthese  circumstances,the  protocol  requires  the sender to send a smallsegment to the receiver now and then, to see if more data  is  accepted.If  the  window  remains closed at zero for some substantial period, andthe sender can obtain  no  response  from  the  receiver,  the  protocolrequires  the  sender  to  conclude that the receiver has failed, and toclose  the  connection.    Again,  there  is  very  little   performance                                   3information  in  the  specification, describing under what circumstancesthe window should be increased, and how the  sender  should  respond  tosuch revised information.     A  bad implementation of the window algorithm can lead to extremelypoor performance overall.  The degradations which  occur  in  throughputand  CPU  utilizations  can easily be several factors of ten, not just afractional increase.  This particular phenomenon is specific enough thatit has been given the name of Silly Window Syndrome, or  SWS.    HappilySWS  is  easy  to  avoid  if  a few simple rules are observed.  The mostimportant function of this memo is to describe SWS, so that implementorswill understand the general nature  of  the  problem,  and  to  describealgorithms  which  will  prevent  its  occurrence.    This document alsodescribes   performance   enhancing   algorithms   which    relate    toacknowledgement,  and  discusses  the  way  acknowledgement  and  windowalgorithms interact as part of SWS.     3.  SILLY WINDOW SYNDROME     In order to understand SWS, we must first  define  two  new  terms.Superficially,  the window mechanism is very simple:  there is a number,called "the window", which is returned from the receiver to the  sender.However,  we  must have a more detailed way of talking about the meaningof this number.  The receiver of data computes a  value  which  we  willcall  the  "offered  window".    In  a  simple  case, the offered windowcorresponds to the amount of buffer space  available  in  the  receiver.This  correspondence  is  not necessarily exact, but is a suitable modelfor the discussion to follow.    It  is  the  offered  window  which  is                                   4actually  transmitted  back from the receiver to the sender.  The senderuses the offered window  to  compute  a  different  value,  the  "usablewindow",  which  is  the  offered window minus the amount of outstandingunacknowledged data.  The usable window is less than  or  equal  to  theoffered window, and can be much smaller.     Consider  the  following  simple  example.   The receiver initiallyprovides an offered window of 1,000.  The sender uses up this window  bysending  five  segments  of 200 bytes each.  The receiver, on processingthe first of these  segments,  returns  an  acknowledgement  which  alsocontains  an  updated  window value.  Let us assume that the receiver ofthe data has removed the first 200 bytes from the buffer,  so  that  thereceiver once again has 1,000 bytes of available buffer.  Therefore, thereceiver would return, as before, an offered window of 1,000 bytes.  Thesender,  on  receipt  of  this  first  acknowledgement, now computes theadditional number of bytes which may be sent.  In  fact,  of  the  1,000bytes  which  the recipient is prepared to receive at this time, 800 arealready in transit, having been sent in response to the previous offeredwindow.  In this case, the usable window is only 200 bytes.     Let us now consider how SWS  arises.    To  continue  the  previousexample,  assume  that at some point, when the sender computes a useablewindow of 200 bytes, it has only 50 bytes to send  until  it  reaches  a"push"  point.   It thus sends 50 bytes in one segment, and 150 bytes inthe next segment. Sometime later, this 50-byte segment  will  arrive  atthe recipient, which will process and remove the 50 bytes and once againreturn  an  offered window of 1,000 bytes.  However, the sender will now                                   5compute  that there are 950 bytes in transit in the network, so that theuseable window is now only 50 bytes.  Thus, the sender will  once  againsend  a  50  byte  segment,  even  though  there  is no longer a naturalboundary to force it.     In fact, whenever the acknowledgement  of  a  small  segment  comesback, the useable window associated with that acknowledgement will causeanother  segment  of  the  same  small  size  to  be  sent,  until  someabnormality breaks the pattern.  It is easy to see  how  small  segmentsarise,  because  natural  boundaries  in the data occasionally cause thesender to take a computed useable window and divide it  up  between  twosegments.   Once that division has occurred, there is no natural way forthose useable window allocations to be recombined; thus the breaking  upof the useable window into small pieces will persist.     Thus,  SWS  is a degeneration in the throughput which develops overtime, during a long data transfer.  If the sender  ever  stops,  as  forexample  when  it runs out of data to send, the receiver will eventuallyacknowledge all  the  outstanding  data,  so  that  the  useable  windowcomputed  by  the  sender  will  equal  the  full  offered window of thereceiver.  At this point the situation will  have  healed,  and  furtherdata  transmission  over  the  link will occur efficiently.  However, inlarge file transfers, which occur without interruption,  SWS  can  causeappalling  performance.  The network between the sender and the receiverbecomes clogged with  many  small  segments,  and  an  equal  number  ofacknowledgements,  which  in  turn  causes lost segments, which triggersmassive retransmission.  Bad cases of SWS have been seen  in  which  the                                   6average  segment  size was one-tenth of the size the sender and receiverwere prepared to deal with, and the average number of retransmission persuccessful segments sent was five.     Happily, SWS is trivial to avoid.  The following sections  describetwo  algorithms,  one  executed  by the sender, and one by the receiver,which appear to eliminate SWS completely.  Actually, either algorithm byitself is sufficient to prevent SWS, and thus  protect  a  host  from  aforeign  implementation  which  has  failed  to  deal properly with thisproblem.  The  two  algorithms  taken  together  produce  an  additionalreduction  in  CPU  consumption, observed in practice to be as high as afactor of four.     4.  Improved Window Algorithms     The receiver of data can take a very simple step to eliminate  SWS.When  it  disposes of a small amount of data, it can artificially reducethe offered window in subsequent acknowledgements, so that  the  useablewindow computed by the sender does not permit the sending of any furtherdata.     At  some  later  time,  when  the  receiver  has  processed  asubstantially larger amount of incoming data, the artificial  limitationon  the  offered  window  can be removed all at once, so that the sendercomputes a sudden large jump rather than a sequence of  small  jumps  inthe useable window.     At  this  level,  the  algorithm  is  quite simple, but in order todetermine exactly when the window should  be  opened  up  again,  it  isnecessary  to  look  at some of the other details of the implementation.                                   7Depending  on whether the window is held artificially closed for a shortor long time, two problems will  develop.    The  one  we  have  alreadydiscussed  -- never closing the window artificially -- will lead to SWS.On the other hand, if  the  window  is  only  opened  infrequently,  thepipeline  of data in the network between the sender and the receiver mayhave emptied out while the sender was being held off, so that a delay isintroduced before additional data arrives from the sender.   This  delaydoes reduce throughput, but it does not consume network resources or CPUresources  in  the  process, as does SWS.  Thus, it is in this directionthat one ought to overcompensate.  For a simple implementation,  a  ruleof  thumb  that  seems to work in practice is to artificially reduce theoffered window until the reduction constitutes one half of the availablespace, at which point increase the window to advertise the entire  spaceagain.  In any event, one ought to make the chunk by which the window isopened  at  least permit one reasonably large segment.  (If the receiveris so short of buffers that it can never advertise a large enough bufferto permit at least one large segment, it is hopeless to expect any  sortof high throughput.)     There  is  an algorithm that the sender can use to achieve the sameeffect described above:  a very simple and elegant rule first  describedby  Michael  Greenwald  at MIT.  The sender of the data uses the offeredwindow to compute a useable window, and then compares the useable windowto the offered window, and refrains from sending anything if  the  ratioof  useable to offered is less than a certain fraction.  Clearly, if thecomputed useable window is small compared to the  offered  window,  thismeans  that a substantial amount of previously sent information is still                                   8in  the  pipeline  from  the sender to the receiver, which in turn meansthat the sender can count on being granted a larger  useable  window  inthe  future.    Until  the  useable window reaches a certain amount, the

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -