home *** CD-ROM | disk | FTP | other *** search
/ Unix System Administration Handbook 1997 October / usah_oct97.iso / rfc / 1600s / rfc1644.txt < prev    next >
Text File  |  1994-07-11  |  87KB  |  2,132 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7. Network Working Group                                          R. Braden
  8. Request for Comments: 1644                                           ISI
  9. Category: Experimental                                         July 1994
  10.  
  11.                 T/TCP -- TCP Extensions for Transactions
  12.                         Functional Specification
  13.  
  14. Status of this Memo
  15.  
  16.    This memo describes an Experimental Protocol for the Internet
  17.    community, and requests discussion and suggestions for improvements.
  18.    It does not specify an Internet Standard.  Distribution is unlimited.
  19.  
  20. Abstract
  21.  
  22.    This memo specifies T/TCP, an experimental TCP extension for
  23.    efficient transaction-oriented (request/response) service.  This
  24.    backwards-compatible extension could fill the gap between the current
  25.    connection-oriented TCP and the datagram-based UDP.
  26.  
  27.    This work was supported in part by the National Science Foundation
  28.    under Grant Number NCR-8922231.
  29.  
  30. Table of Contents
  31.  
  32.  1. INTRODUCTION ..................................................  2
  33.  2.  OVERVIEW .....................................................  3
  34.     2.1  Bypassing the Three-Way Handshake ........................  4
  35.     2.2  Transaction Sequences ....................................  6
  36.     2.3  Protocol Correctness .....................................  8
  37.     2.4  Truncating TIME-WAIT State ............................... 12
  38.     2.5  Transition to Standard TCP Operation ..................... 14
  39.  3.  FUNCTIONAL SPECIFICATION ..................................... 17
  40.     3.1  Data Structures .......................................... 17
  41.     3.2  New TCP Options .......................................... 17
  42.     3.3  Connection States ........................................ 19
  43.     3.4  T/TCP Processing Rules ................................... 25
  44.     3.5  User Interface ........................................... 28
  45.  4.  IMPLEMENTATION ISSUES ........................................ 30
  46.     4.1  RFC-1323 Extensions ...................................... 30
  47.     4.2  Minimal Packet Sequence .................................. 31
  48.     4.3  RTT Measurement .......................................... 31
  49.     4.4  Cache Implementation ..................................... 32
  50.     4.5  CPU Performance .......................................... 32
  51.     4.6  Pre-SYN Queue ............................................ 33
  52.  6.  ACKNOWLEDGMENTS .............................................. 34
  53.  7.  REFERENCES ................................................... 34
  54.  APPENDIX A.  ALGORITHM SUMMARY ................................... 35
  55.  
  56.  
  57.  
  58. Braden                                                          [Page 1]
  59.  
  60. RFC 1644                    Transaction/TCP                    July 1994
  61.  
  62.  
  63.  Security Considerations .......................................... 38
  64.  Author's Address ................................................. 38
  65.  
  66. 1. INTRODUCTION
  67.  
  68.    TCP was designed to around the virtual circuit model, to support
  69.    streaming of data.  Another common mode of communication is a
  70.    client-server interaction, a request message followed by a response
  71.    message.  The request/response paradigm is used by application-layer
  72.    protocols that implement transaction processing or remote procedure
  73.    calls, as well as by a number of network control and management
  74.    protocols (e.g., DNS and SNMP).  Currently, many Internet user
  75.    programs that need request/response communication use UDP, and when
  76.    they require transport protocol functions such as reliable delivery
  77.    they must effectively build their own private transport protocol at
  78.    the application layer.
  79.  
  80.    Request/response, or "transaction-oriented", communication has the
  81.    following features:
  82.  
  83.    (a)  The fundamental interaction is a request followed by a response.
  84.  
  85.    (b)  An explicit open or close phase may impose excessive overhead.
  86.  
  87.    (c)  At-most-once semantics is required; that is, a transaction must
  88.         not be "replayed" as the result of a duplicate request packet.
  89.  
  90.    (d)  The minimum transaction latency for a client should be RTT +
  91.         SPT, where RTT is the round-trip time and SPT is the server
  92.         processing time.
  93.  
  94.    (e)  In favorable circumstances, a reliable request/response
  95.         handshake should be achievable with exactly one packet in each
  96.         direction.
  97.  
  98.    This memo concerns T/TCP, an backwards-compatible extension of TCP to
  99.    provide efficient transaction-oriented service in addition to
  100.    virtual-circuit service.  T/TCP provides all the features listed
  101.    above, except for (e); the minimum exchange for T/TCP is three
  102.    segments.
  103.  
  104.    In this memo, we use the term "transaction" for an elementary
  105.    request/response packet sequence.  This is not intended to imply any
  106.    of the semantics often associated with application-layer transaction
  107.    processing, like 3-phase commits.  It is expected that T/TCP can be
  108.    used as the transport layer underlying such an application-layer
  109.    service, but the semantics of T/TCP is limited to transport-layer
  110.    services such as reliable, ordered delivery and at-most-once
  111.  
  112.  
  113.  
  114. Braden                                                          [Page 2]
  115.  
  116. RFC 1644                    Transaction/TCP                    July 1994
  117.  
  118.  
  119.    operation.
  120.  
  121.    An earlier memo [RFC-1379] presented the concepts involved in T/TCP.
  122.    However, the real-world usefulness of these ideas depends upon
  123.    practical issues like implementation complexity and performance.  To
  124.    help explore these issues, this memo presents a functional
  125.    specification for a particular embodiment of the ideas presented in
  126.    RFC-1379.  However, the specific algorithms in this memo represent a
  127.    later evolution than RFC-1379.  In particular, Appendix A in RFC-1379
  128.    explained the difficulties in truncating TIME-WAIT state.  However,
  129.    experience with an implementation of the RFC-1379 algorithms in a
  130.    workstation later showed that accumulation of TCB's in TIME-WAIT
  131.    state is an intolerable problem; this necessity led to a simple
  132.    solution for truncating TIME-WAIT state, described in this memo.
  133.  
  134.    Section 2 introduces the T/TCP extensions, and section 3 contains the
  135.    complete specification of T/TCP.  Section 4 discusses some
  136.    implementation issues, and Appendix A contains an algorithmic
  137.    summary.  This document assumes familiarity with the standard TCP
  138.    specification [STD-007].
  139.  
  140. 2.  OVERVIEW
  141.  
  142.    The TCP protocol is highly symmetric between the two ends of a
  143.    connection.  This symmetry is not lost in T/TCP; for example, T/TCP
  144.    supports TCP's symmetric simultaneous open from both sides (Section
  145.    2.3 below).  However, transaction sequences use T/TCP in a highly
  146.    unsymmetrical manner.  It is convenient to use the terms "client
  147.    host" and "server host" for the host that initiates a connection and
  148.    the host that responds, respectively.
  149.  
  150.    The goal of T/TCP is to allow each transaction, i.e., each
  151.    request/response sequence, to be efficiently performed as a single
  152.    incarnation of a TCP connection.  Standard TCP imposes two
  153.    performance problems for transaction-oriented communication.  First,
  154.    a TCP connection is opened with a "3-way handshake", which must
  155.    complete successfully before data can be transferred.  The 3-way
  156.    handshake adds an extra RTT (round trip time) to the latency of a
  157.    transaction.
  158.  
  159.    The second performance problem is that closing a TCP connection
  160.    leaves one or both ends in TIME-WAIT state for a time 2*MSL, where
  161.    MSL is the maximum segment lifetime (defined to be 120 seconds).
  162.    TIME-WAIT state severely limits the rate of successive transactions
  163.    between the same (host,port) pair, since a new incarnation of the
  164.    connection cannot be opened until the TIME-WAIT delay expires.  RFC-
  165.    1379 explained why the alternative approach, using a different user
  166.    port for each transaction between a pair of hosts, also limits the
  167.  
  168.  
  169.  
  170. Braden                                                          [Page 3]
  171.  
  172. RFC 1644                    Transaction/TCP                    July 1994
  173.  
  174.  
  175.    transaction rate: (1) the 16-bit port space limits the rate to
  176.    2**16/240 transactions per second, and (2) more practically, an
  177.    excessive amount of kernel space would be occupied by TCP state
  178.    blocks in TIME-WAIT state [RFC-1379].
  179.  
  180.    T/TCP solves these two performance problems for transactions, by (1)
  181.    bypassing the 3-way handshake (3WHS) and (2) shortening the delay in
  182.    TIME-WAIT state.
  183.  
  184.    2.1  Bypassing the Three-Way Handshake
  185.  
  186.       T/TCP introduces a 32-bit incarnation number, called a "connection
  187.       count" (CC), that is carried in a TCP option in each segment.  A
  188.       distinct CC value is assigned to each direction of an open
  189.       connection.  A T/TCP implementation assigns monotonically
  190.       increasing CC values to successive connections that it opens
  191.       actively or passively.
  192.  
  193.       T/TCP uses the monotonic property of CC values in initial <SYN>
  194.       segments to bypass the 3WHS, using a mechanism that we call TCP
  195.       Accelerated Open (TAO).  Under the TAO mechanism, a host caches a
  196.       small amount of state per remote host.  Specifically, a T/TCP host
  197.       that is acting as a server keeps a cache containing the last valid
  198.       CC value that it has received from each different client host.  If
  199.       an initial <SYN> segment (i.e., a segment containing a SYN bit but
  200.       no ACK bit) from a particular client host carries a CC value
  201.       larger than the corresponding cached value, the monotonic property
  202.       of CC's ensures that the <SYN> segment must be new and can
  203.       therefore be accepted immediately.  Otherwise, the server host
  204.       does not know whether the <SYN> segment is an old duplicate or was
  205.       simply delivered out of order; it therefore executes a normal 3WHS
  206.       to validate the <SYN>.  Thus, the TAO mechanism provides an
  207.       optimization, with the normal TCP mechanism as a fallback.
  208.  
  209.       The CC value carried in non-<SYN> segments is used to protect
  210.       against old duplicate segments from earlier incarnations of the
  211.       same connection (we call such segments 'antique duplicates' for
  212.       short).  In the case of short connections (e.g., transactions),
  213.       these CC values allow TIME-WAIT state delay to be safely discuss
  214.       in Section 2.3.
  215.  
  216.       T/TCP defines three new TCP options, each of which carries one
  217.       32-bit CC value.  These options are named CC, CC.NEW, and CC.ECHO.
  218.       The CC option is normally used; CC.NEW and CC.ECHO have special
  219.       functions, as follows.
  220.  
  221.  
  222.  
  223.  
  224.  
  225.  
  226. Braden                                                          [Page 4]
  227.  
  228. RFC 1644                    Transaction/TCP                    July 1994
  229.  
  230.  
  231.       (a)  CC.NEW
  232.  
  233.            Correctness of the TAO mechanism requires that clients
  234.            generate monotonically increasing CC values for successive
  235.            connection initiations.  These values can be generated using
  236.            a simple global counter.  There are certain circumstances
  237.            (discussed below in Section 2.2) when the client knows that
  238.            monotonicity may be violated; in this case, it sends a CC.NEW
  239.            rather than a CC option in the initial <SYN> segment.
  240.            Receiving a CC.NEW causes the server to invalidate its cache
  241.            entry and do a 3WHS.
  242.  
  243.       (b)  CC.ECHO
  244.  
  245.            When a server host sends a <SYN,ACK> segment, it echoes the
  246.            connection count from the initial <SYN> in a CC.ECHO option,
  247.            which is used by the client host to validate the <SYN,ACK>
  248.            segment.
  249.  
  250.       Figure 1 illustrates the TAO mechanism bypassing a 3WHS.  The
  251.       cached CC values, denoted by cache.CC[host], are shown on each
  252.       side.  The server host compares the new CC value x in segment #1
  253.       against x0, its cached value for client host A; this comparison is
  254.       called the "TAO test".  Since x > x0, the <SYN> must be new and
  255.       can be accepted immediately; the data in the segment can therefore
  256.       be delivered to the user process B, and the cached value is
  257.       updated.  If the TAO test failed (x <= x0), the server host would
  258.       do a normal three-way handshake to validate the <SYN> segment, but
  259.       the cache would not be updated.
  260.  
  261.  
  262.  
  263.  
  264.  
  265.  
  266.  
  267.  
  268.  
  269.  
  270.  
  271.  
  272.  
  273.  
  274.  
  275.  
  276.  
  277.  
  278.  
  279.  
  280.  
  281.  
  282. Braden                                                          [Page 5]
  283.  
  284. RFC 1644                    Transaction/TCP                    July 1994
  285.  
  286.  
  287.  
  288.           TCP A  (Client)                              TCP B (Server)
  289.           _______________                              ______________
  290.  
  291.                                                           cache.CC[A]
  292.                                                             V
  293.  
  294.                                                           [ x0 ]
  295.  
  296.         #1        -->  <SYN, data1, CC=x> -->  (TAO test OK (x > x0) =>
  297.                                                      data1->user_B and
  298.                                                      cache.CC[A]= x; )
  299.  
  300.                                                            [ x ]
  301.         #2       <-- <SYN, ACK(data1), data2, CC=y, CC.ECHO=x> <--
  302.             (data2->user_A;)
  303.  
  304.  
  305.               Figure 1. TAO: Three-Way Handshake is Bypassed
  306.  
  307.  
  308.       The CC value x is echoed in a CC.ECHO option in the <SYN,ACK>
  309.       segment (#2); the client side uses this option to validate the
  310.       segment.  Since segment #2 is valid, its data2 is delivered to the
  311.       client user process.  Segment #2 also carries B's CC value; this
  312.       is used by A to validate non-SYN segments from B, as explained in
  313.       Section 2.4.
  314.  
  315.       Implementing the T/TCP extensions expands the connection control
  316.       block (TCB) to include the two CC values for the connection; call
  317.       these variables TCB.CCsend and TCB.CCrecv (or CCsend, CCrecv for
  318.       short).  For example, the sequence shown in Figure 1 sets
  319.       TCB.CCsend = x and TCB.CCrecv = y at host A, and vice versa at
  320.       host B.  Any segment that is received with a CC option containing
  321.       a value SEG.CC different from TCB.CCsend will be rejected as an
  322.       antique duplicate.
  323.  
  324.    2.2  Transaction Sequences
  325.  
  326.       T/TCP applies the TAO mechanism described in the previous section
  327.       to perform a transaction sequence.  Figure 2 shows a minimal
  328.       transaction, when the request and response data can each fit into
  329.       a single segment.  This requires three segments and completes in
  330.       one round-trip time (RTT).  If the TAO test had failed on segment
  331.       #1, B would have queued data1 and the FIN for later processing,
  332.       and then it would have returned a <SYN,ACK> segment to A, to
  333.       perform a normal 3WHS.
  334.  
  335.  
  336.  
  337.  
  338. Braden                                                          [Page 6]
  339.  
  340. RFC 1644                    Transaction/TCP                    July 1994
  341.  
  342.  
  343.  
  344.        TCP A  (Client)                                    TCP B (Server)
  345.        _______________                                    ______________
  346.  
  347.        CLOSED                                                     LISTEN
  348.  
  349.    #1  SYN-SENT*        --> <SYN,data1,FIN,CC=x> -->         CLOSE-WAIT*
  350.                                                            (TAO test OK)
  351.                                                          (data1->user_B)
  352.  
  353.                                                            <-- LAST-ACK*
  354.    #2  TIME-WAIT   <-- <SYN,ACK(FIN),data2,FIN,CC=y,CC.ECHO=x>
  355.      (data2->user_A)
  356.  
  357.  
  358.    #3  TIME-WAIT          --> <ACK(FIN),CC=x> -->                 CLOSED
  359.  
  360.        (timeout)
  361.          CLOSED
  362.  
  363.              Figure 2: Minimal T/TCP Transaction Sequence
  364.  
  365.  
  366.       T/TCP extensions require additional connection states, e.g., the
  367.       SYN-SENT*, CLOSE-WAIT*, and LAST-ACK* states shown in Figure 2.
  368.       Section 3.3 describes these new connection states.
  369.  
  370.       To obtain the minimal 3-segment sequence shown in Figure 2, the
  371.       server host must delay acknowledging segment #1 so the response
  372.       may be piggy-backed on segment #2.  If the application takes
  373.       longer than this delay to compute the response, the normal TCP
  374.       retransmission mechanism in TCP B will send an acknowledgment to
  375.       forestall a retransmission from TCP A.  Figure 3 shows an example
  376.       of a slow server application.  Although the sequence in Figure 3
  377.       does contain a 3-way handshake, the TAO mechanism has allowed the
  378.       request data to be accepted immediately, so that the client still
  379.       sees the minimum latency.
  380.  
  381.  
  382.  
  383.  
  384.  
  385.  
  386.  
  387.  
  388.  
  389.  
  390.  
  391.  
  392.  
  393.  
  394. Braden                                                          [Page 7]
  395.  
  396. RFC 1644                    Transaction/TCP                    July 1994
  397.  
  398.  
  399.  
  400.        TCP A  (Client)                                    TCP B (Server)
  401.        _______________                                    ______________
  402.  
  403.        CLOSED                                                     LISTEN
  404.  
  405.    #1  SYN-SENT*       --> <SYN,data1,FIN,CC=x> -->          CLOSE-WAIT*
  406.                                                         (TAO test OK =>
  407.                                                           data1->user_B)
  408.  
  409.                                                                (timeout)
  410.    #2  FIN-WAIT-1  <-- <SYN,ACK(FIN),CC=y,CC.ECHO=x> <--     CLOSE-WAIT*
  411.  
  412.  
  413.    #3  FIN-WAIT-1      --> <ACK(SYN),FIN,CC=x> -->            CLOSE-WAIT
  414.  
  415.  
  416.    #4  TIME-WAIT   <-- <ACK(FIN),data2,FIN,CC=y> <--            LAST-ACK
  417.        (data2->user_A)
  418.  
  419.    #5  TIME_WAIT       --> <ACK(FIN),CC=x> -->                    CLOSED
  420.  
  421.          (timeout)
  422.         CLOSED
  423.  
  424.                   Figure 3: Acknowledgment Timeout in Server
  425.  
  426.  
  427.    2.3  Protocol Correctness
  428.  
  429.       This section fills in more details of the TAO mechanism and
  430.       provides an informal sketch of why the T/TCP protocol works.
  431.  
  432.       CC values are 32-bit integers.  The TAO test requires the same
  433.       kind of modular arithmetic that is used to compare two TCP
  434.       sequence numbers.  We assume that the boundary between y < z and z
  435.       < y for two CC values y and z occurs when they differ by 2**31,
  436.       i.e., by half the total CC space.
  437.  
  438.       The essential requirement for correctness of T/TCP is this:
  439.  
  440.            CC values must advance at a rate slower than 2**31      [R1]
  441.            counts per 2*MSL
  442.  
  443.       where MSL denotes the maximum segment lifetime in the Internet.
  444.       The requirement [R1] is easily met with a 32-bit CC.  For example,
  445.       it will allow 10**6 transactions per second with the very liberal
  446.       MSL of 1000 seconds [RFC-1379].  This is well in excess of the
  447.  
  448.  
  449.  
  450. Braden                                                          [Page 8]
  451.  
  452. RFC 1644                    Transaction/TCP                    July 1994
  453.  
  454.  
  455.       transaction rates achievable with current operating systems and
  456.       network latency.
  457.  
  458.       Assume for the present that successive connections from client A
  459.       to server B contain only monotonically increasing CC values.  That
  460.       is, if x(i) and x(i+1) are CC values carried in two successive
  461.       initial <SYN> segments from the same host, then x(i+1) > x(i).
  462.       Assuming the requirement [R1], the CC space cannot wrap within the
  463.       range of segments that can be outstanding at one time.  Therefore,
  464.       those successive <SYN> segments from a given host that have not
  465.       exceeded their MSL must contain an ordered set of CC values:
  466.  
  467.              x(1) < x(2) < x(3) ... < x(n),
  468.  
  469.       where the modular comparisons have been replaced by simple
  470.       arithmetic comparisons. Here x(n) is the most recent acceptable
  471.       <SYN>, which is cached by the server.  If the server host receives
  472.       a <SYN> segment containing a CC option with value y where y >
  473.       x(n), that <SYN> must be newer; an antique duplicate SYN with CC
  474.       value greater than x(n) must have exceeded its MSL and vanished.
  475.       Hence, monotonic CC values and the TAO test prevent erroneous
  476.       replay of antique <SYN>s.
  477.  
  478.       There are two possible reasons for a client to generate non-
  479.       monotonic CC values: (a) the client may have crashed and
  480.       restarted, causing the generated CC values to jump backwards; or
  481.       (b) the generated CC values may have wrapped around the finite
  482.       space.  Wraparound may occur because CC generation is global to
  483.       all connections.  Suppose that host A sends a transaction to B,
  484.       then sends more than 2**31 transactions to other hosts, and
  485.       finally sends another transaction to B.  From B's viewpoint, CC
  486.       will have jumped backward relative to its cached value.
  487.  
  488.       In either of these two cases, the server may see the CC value jump
  489.       backwards only after an interval of at least MSL since the last
  490.       <SYN> segment from the same client host.  In case (a), client host
  491.       restart, this is because T/TCP retains TCP's explicit "Quiet Time"
  492.       of an MSL interval [STD-007].  In case (b). wrap around, [R1]
  493.       ensures that a time of at least MSL must have passed before the CC
  494.       space wraps around.  Hence, there is no possibility that a TAO
  495.       test will succeed erroneously due to either cause of non-
  496.       monotonicity; i.e., there is no chance of replays due to TAO.
  497.  
  498.       However, although CC values jumping backwards will not cause an
  499.       error, it may cause a performance degradation due to unnecessary
  500.       3WHS's.  This results from the generated CC values jumping
  501.       backwards through approximately half their range, so that all
  502.       succeeding TAO tests fail until the generated CC values catch up
  503.  
  504.  
  505.  
  506. Braden                                                          [Page 9]
  507.  
  508. RFC 1644                    Transaction/TCP                    July 1994
  509.  
  510.  
  511.       to the cached value.  To avoid this degradation, a client host
  512.       sends a CC.NEW option instead of a CC option in the case of either
  513.       system restart or CC wraparound.  Receiving CC.NEW forces a 3WHS,
  514.       but when this 3WHS completes successfully the server cache is
  515.       updated to the new CC value.  To detect CC wraparound, the client
  516.       must cache the last CC value it sent to each server.  It therefore
  517.       maintains cache.CCsent[B] for each server B.  If this cached value
  518.       is undefined or if it is larger than the next CC value generated
  519.       at the client, then the client sends a CC.NEW instead of a CC
  520.       option in the next SYN segment.
  521.  
  522.       This is illustrated in Figure 4, which shows the scenario for the
  523.       first transaction from A to B after the client host A has crashed
  524.       and recovered.  A similar sequence occurs if x is not greater than
  525.       cache.CCsent[B], i.e., if there is a wraparound of the generated
  526.       CC values.  Because segment #1 contains a CC.NEW option, the
  527.       server host invalidates the cache entry and does a 3WHS; however,
  528.       it still sets B's TCB.CCrecv for this connection to x.  TCP B uses
  529.       this CCrecv value to validate the <ACK> segment (#3) that
  530.       completes the 3WHS.  Receipt of this segment updates cache.CC[A],
  531.       since the cache entry was previously undefined.  (If a 3WHS always
  532.       updated the cache, then out-of-order SYN segments could cause the
  533.       cached value to jump backwards, possibly allowing replays).
  534.       Finally, the CC.ECHO option in the <SYN,ACK> segment #2 defines
  535.       A's cache.CCsent entry.
  536.  
  537.       This algorithm delays updating cache.CCsent[] until the <SYN> has
  538.       been ACK'd.  This allows the undefined cache.CCsent value to used
  539.       as a a "first-time switch" to reliable resynchronization of the
  540.       cached value at the server after a crash or wraparound.
  541.  
  542.       When we use the term "cache", we imply that the value can be
  543.       discarded at any time without introducing erroneous behavior
  544.       although it may degrade performance.
  545.  
  546.       (a)  If a server host receives an initial <SYN> from client A but
  547.            has no cached value cache.CC[A], the server simply forces a
  548.            3WHS to validate the <SYN> segment.
  549.  
  550.       (b)  If a client host has no cached value cache.CCsent[B] when it
  551.            needs to send an initial <SYN> segment, the client simply
  552.            sends a CC.NEW option in the segment.  This forces a 3WHS at
  553.            the server.
  554.  
  555.  
  556.  
  557.  
  558.  
  559.  
  560.  
  561.  
  562. Braden                                                         [Page 10]
  563.  
  564. RFC 1644                    Transaction/TCP                    July 1994
  565.  
  566.  
  567.           TCP A  (Client)                                TCP B (Server)
  568.           _______________                                ______________
  569.  
  570.           cache.CCsent[B]                                   cache.CC[A]
  571.               V                                                  V
  572.  
  573.         (Crash and restart)
  574.             [ ?? ]                                            [ x0 ]
  575.  
  576.         #1         --> <SYN, data1,CC.NEW=x> -->      (invalidate cache;
  577.                                                             queue data1;
  578.                                                         3-way handshake)
  579.  
  580.             [ ?? ]                                            [ ?? ]
  581.         #2          <-- <SYN, ACK(data1),CC=y,CC.ECHO=x> <--
  582.           (cache.CCsent[B]= x;)
  583.  
  584.             [ x ]                                             [ ?? ]
  585.  
  586.         #3                  --> <ACK(SYN),CC=x> -->       data1->user_B;
  587.                                                          cache.CC[A]= x;
  588.  
  589.             [ x ]                                              [ x ]
  590.  
  591.                       Figure 4.  Client Host Restarting
  592.  
  593.  
  594.       So far, we have considered only correctness of the TAO mechanism
  595.       for bypassing the 3WHS.  We must also protect a connection against
  596.       antique duplicate non-SYN segments.  In standard TCP, such
  597.       protection is one of the functions of the TIME-WAIT state delay.
  598.       (The other function is the TCP full-duplex close semantics, which
  599.       we need to preserve; that is discussed below in Section 2.5).  In
  600.       order to achieve a high rate of transaction processing, it must be
  601.       possible to truncate this TIME-WAIT state delay without exposure
  602.       to antique duplicate segments [RFC-1379].
  603.  
  604.       For short connections (e.g., transactions), the CC values assigned
  605.       to each direction of the connection can be used to protect against
  606.       antique duplicate non-SYN segments.  Here we define "short" as a
  607.       duration less than MSL.  Suppose that there is a connection that
  608.       uses the CC values TCB.CCsend = x and TCB.CCrecv = y.  By the
  609.       requirement [R1], neither x nor y can be reused for a new
  610.       connection from the same remote host for a time at least 2*MSL.
  611.       If the connection has been in existence for a time less than MSL,
  612.       then its CC values will not be reused for a period that exceeds
  613.       MSL, and therefore all antique duplicates with that CC value must
  614.       vanish before it is reused.  Thus, for "short" connections we can
  615.  
  616.  
  617.  
  618. Braden                                                         [Page 11]
  619.  
  620. RFC 1644                    Transaction/TCP                    July 1994
  621.  
  622.  
  623.       guard against antique non-SYN segments by simply checking the CC
  624.       value in the segment againsts TCB.CCrecv.  Note that this check
  625.       does not use the monotonic property of the CC values, only that
  626.       they not cycle in less than 2*MSL.  Again, the quiet time at
  627.       system restart protects against errors due to crash with loss of
  628.       state.
  629.  
  630.       If the connection duration exceeds MSL, safety from old duplicates
  631.       still requires a TIME-WAIT delay of 2*MSL.  Thus, truncation of
  632.       TIME-WAIT state is only possible for short connections.  (This
  633.       problem has also been noticed by Shankar and Lee [ShankarLee93]).
  634.       This difference in behavior for long and for short connections
  635.       does create a slightly complex service model for applications
  636.       using T/TCP.  An application has two different strategies for
  637.       multiple connections.  For "short" connections, it should use a
  638.       fixed port pair and use the T/TCP mechanism to get rapid and
  639.       efficient transaction processing.  For connections whose durations
  640.       are of the order of MSL or longer, it should use a different user
  641.       port for each successive connection, as is the current practice
  642.       with unmodified TCP.  The latter strategy will cause excessive
  643.       overhead (due to TCB's in TIME-WAIT state) if it is applied to
  644.       high-frequency short connections.  If an application makes the
  645.       wrong choice, its attempt to open a new connection may fail with a
  646.       "busy" error.  If connection durations may range between long and
  647.       short, an application may have to be able to switch strategies
  648.       when one fails.
  649.  
  650.    2.4  Truncating TIME-WAIT State
  651.  
  652.       Truncation of TIME-WAIT state is necessary to achieve high
  653.       transaction rates.  As Figure 2 illustrates, a standard
  654.       transaction leaves the client end of the connection in TIME-WAIT
  655.       state.  This section explains the protocol implications of
  656.       truncating TIME-WAIT state, when it is allowed (i.e., when the
  657.       connection has been in existence for less than MSL).  In this
  658.       case, the client host should be able to interrupt TIME-WAIT state
  659.       to initiate a new incarnation of the same connection (i.e., using
  660.       the same host and ports).  This will send an initial <SYN>
  661.       segment.
  662.  
  663.       It is possible for the new <SYN> to arrive at the server before
  664.       the retransmission state from the previous incarnation is gone, as
  665.       shown in Figure 5.  Here the final <ACK> (segment #3) from the
  666.       previous incarnation is lost, leaving retransmission state at B.
  667.       However, the client received segment #2 and thinks the transaction
  668.       completed successfully, so it can initiate a new transaction by
  669.       sending <SYN> segment #4.  When this <SYN> arrives at the server
  670.       host, it must implicitly acknowledge segment #2, signalling
  671.  
  672.  
  673.  
  674. Braden                                                         [Page 12]
  675.  
  676. RFC 1644                    Transaction/TCP                    July 1994
  677.  
  678.  
  679.       success to the server application, deleting the old TCB, and
  680.       creating a new TCB, as shown in Figure 5.  Still assuming that the
  681.       new <SYN> is known to be valid, the server host marks the new
  682.       connection half-synchronized and delivers data3 to the server
  683.       application.  (The details of how this is accomplished are
  684.       presented in Section 3.3.)
  685.  
  686.       The earlier discussion of the TAO mechanism assumed that the
  687.       previous incarnation was closed before a new <SYN> arrived at the
  688.       server.  However, TAO cannot be used to validate the <SYN> if
  689.       there is still state from the previous incarnation, as shown in
  690.       Figure 5; in this case, it would be exceedingly awkward to perform
  691.       a 3WHS if the TAO test should fail.  Fortunately, a modified
  692.       version of the TAO test can still be performed, using the state in
  693.       the earlier TCB rather than the cached state.
  694.  
  695.       (A)  If the <SYN> segment contains a CC or CC.NEW option, the
  696.            value SEG.CC from this option is compared with TCB.CCrecv,
  697.            the CC value in the still-existing state block of the
  698.            previous incarnation.  If SEG.CC > TCB.CCrecv, the new <SYN>
  699.            segment must be valid.
  700.  
  701.       (B)  Otherwise, the <SYN> is an old duplicate and is simply
  702.            discarded.
  703.  
  704.       Truncating TIME-WAIT state may be looked upon as composing an
  705.       extended state machine that joins the state machines of the two
  706.       incarnations, old and new.  It may be described by introducing new
  707.       intermediate states (which we call I-states), with transitions
  708.       that join the two diagrams and share some state from each.  I-
  709.       states are detailed in Section 3.3.
  710.  
  711.       Notice also segment #2' in Figure 5.  TCP's mechanism to recover
  712.       from half-open connections (see Figure 10 of [STD-007]) cause TCP
  713.       A to send a RST when 2' arrives, which would incorrectly make B
  714.       think that the previous transaction did not complete successfully.
  715.       The half-open recovery mechanism must be defeated in this case, by
  716.       A ignoring segment #2'.
  717.  
  718.  
  719.  
  720.  
  721.  
  722.  
  723.  
  724.  
  725.  
  726.  
  727.  
  728.  
  729.  
  730. Braden                                                         [Page 13]
  731.  
  732. RFC 1644                    Transaction/TCP                    July 1994
  733.  
  734.  
  735.  
  736.       TCP A  (Client)                                     TCP B (Server)
  737.       _______________                                     ______________
  738.  
  739.       CLOSED                                                      LISTEN
  740.  
  741.   #1                --> <...,FIN,CC=x> -->                     LAST-ACK*
  742.  
  743.   #2         <-- <...ACK(FIN),data2,FIN,CC=y,CC.ECHO=x>  <---  LAST-ACK*
  744.       TIME-WAIT
  745.     (data2->user_A)
  746.  
  747.  
  748.   #3  TIME-WAIT          --> <ACK(FIN),CC=x> --> X (DROP)
  749.  
  750.       (New Active Open)                           (New Passive Open)
  751.  
  752.   #4  SYN-SENT*    -->  <SYN, data3,CC=z> ...
  753.  
  754.                                                                LISTEN-LA
  755.   #2' (discard) <-- <...ACK(FIN),data2,FIN,CC=y> <--- (retransmit)
  756.  
  757.   #4  SYN-SENT*        ... <SYN,data3,CC=z> -->            ESTABLISHED*
  758.                                                     SYN OK (see text) =>
  759.                                                             {Ack seg #2;
  760.                                                          Delete old TCB;
  761.                                                          Create new TCB;
  762.                                                         data3 -> user_B;
  763.                                                         cache.CC[A]= z;}
  764.  
  765.         Figure 5: Truncating TIME-WAIT State: SYN as Implicit ACK
  766.  
  767.  
  768.    2.5  Transition to Standard TCP Operation
  769.  
  770.       T/TCP includes all normal TCP semantics, and it will continue to
  771.       operate exactly like TCP when the particular assumptions for
  772.       transactions do not hold.  There is no limit on the size of an
  773.       individual transaction, and behavior of T/TCP should merge
  774.       seamlessly from pure transaction operation as shown in Figure 2,
  775.       to pure streaming mode for sending large files.  All the sequences
  776.       shown in [STD-007] are still valid, and the inherent symmetry of
  777.       TCP is preserved.
  778.  
  779.       Figure 6 shows a possible sequence when the request and response
  780.       messages each require two segments.  Segment #2 is a non-SYN
  781.       segment that contains a TCP option.  To avoid compatibility
  782.       problems with existing TCP implementations, the client side should
  783.  
  784.  
  785.  
  786. Braden                                                         [Page 14]
  787.  
  788. RFC 1644                    Transaction/TCP                    July 1994
  789.  
  790.  
  791.       send segment #2 only if cache.CCsent[B] is defined, i.e., only if
  792.       host A knows that host B plays the new game.
  793.  
  794.  
  795.  
  796.           TCP A  (Client)                                 TCP B (Server)
  797.           _______________                                 ______________
  798.  
  799.           CLOSED                                                  LISTEN
  800.  
  801.  
  802.        #1  SYN-SENT*       --> <SYN,data1,CC=x>  -->        ESTABLISHED*
  803.                                                        (TAO test OK =>
  804.                                                         data1-> user)
  805.  
  806.        #2  SYN-SENT*       --> <data2,FIN,CC=x>  -->         CLOSE-WAIT*
  807.                                                        (data2-> user)
  808.  
  809.                                                              CLOSE-WAIT*
  810.        #3  FIN-WAIT-2  <-- <SYN,ACK(FIN),data3,CC=y,CC.ECHO=x> <--
  811.             (data3->user)
  812.  
  813.        #4  TIME_WAIT   <-- <ACK(FIN),data4,FIN,CC=y> <--       LAST-ACK*
  814.             (data4->user)
  815.  
  816.        #5  TIME-WAIT       --> <ACK(FIN),CC=x> -->                CLOSED
  817.  
  818.  
  819.             Figure 6. Multi-Packet Request/Response Sequence
  820.  
  821.       Figure 7 shows a more complex example, one possible sequence with
  822.       TAO combined with simultaneous open and close.  This may be
  823.       compared with Figure 8 of [STD-007].
  824.  
  825.  
  826.  
  827.  
  828.  
  829.  
  830.  
  831.  
  832.  
  833.  
  834.  
  835.  
  836.  
  837.  
  838.  
  839.  
  840.  
  841.  
  842. Braden                                                         [Page 15]
  843.  
  844. RFC 1644                    Transaction/TCP                    July 1994
  845.  
  846.  
  847.  
  848.           TCP A                                                    TCP B
  849.           _______________                                 ______________
  850.  
  851.           CLOSED                                                  CLOSED
  852.  
  853.       #1  SYN-SENT*         --> <SYN,data1,FIN,CC=x> ...
  854.  
  855.       #2  CLOSING*     <-- <SYN,data2,FIN,CC=y> <--            SYN-SENT*
  856.           (TAO test OK =>
  857.            data2->user_A
  858.  
  859.       #3  CLOSING*      --> <FIN,ACK(FIN),CC=x,CC.ECHO=y> ...
  860.  
  861.       #1'                       ... <SYN,data1,FIN,CC=x> -->    CLOSING*
  862.                                                        (TAO test OK =>
  863.                                                         data1->user_B)
  864.  
  865.       #4  TIME-WAIT   <-- <FIN,ACK(FIN),CC=y,CC.ECHO=x> <--     CLOSING*
  866.  
  867.       #5  TIME-WAIT    --> <ACK(FIN),CC=x> ...
  868.  
  869.       #3'              ... <FIN,ACK(FIN),CC=x,CC.ECHO=y> -->   TIME-WAIT
  870.  
  871.       #6  TIME-WAIT            <-- <ACK(FIN),CC=y> <---        TIME-WAIT
  872.  
  873.       #5' TIME-WAIT               ... <ACK(FIN),CC=x> -->      TIME-WAIT
  874.  
  875.           (timeout)                                            (timeout)
  876.             CLOSED                                                CLOSED
  877.  
  878.                   Figure 7: Simultaneous Open and Close
  879.  
  880.  
  881.  
  882.  
  883.  
  884.  
  885.  
  886.  
  887.  
  888.  
  889.  
  890.  
  891.  
  892.  
  893.  
  894.  
  895.  
  896.  
  897.  
  898. Braden                                                         [Page 16]
  899.  
  900. RFC 1644                    Transaction/TCP                    July 1994
  901.  
  902.  
  903. 3.  FUNCTIONAL SPECIFICATION
  904.  
  905.    3.1  Data Structures
  906.  
  907.       A connection count is an unsigned 32-bit integer, with the value
  908.       zero excluded.  Zero is used to denote an undefined value.
  909.  
  910.       A host maintains a global connection count variable CCgen, and
  911.       each connection control block (TCB) contains two new connection
  912.       count variables, TCB.CCsend and TCB.CCrecv.  Whenever a TCB is
  913.       created for the active or passive end of a new connection, CCgen
  914.       is incremented by 1 and placed in TCB.CCsend of the TCB; however,
  915.       if the previous CCgen value was 0xffffffff (-1), then the next
  916.       value should be 1.  TCB.CCrecv is initialized to zero (undefined).
  917.  
  918.       T/TCP adds a per-host cache to TCP.  An entry in this cache for
  919.       foreign host fh includes two CC values, cache.CC[fh] and
  920.       cache.CCsent[fh].  It may include other values, as discussed in
  921.       Sections 4.3 and 4.4.  According to [STD-007], a TCP is not
  922.       permitted to send a segment larger than the default size 536,
  923.       unless it has received a larger value in an MSS (Maximum Segment
  924.       Size) option.  This could constrain the client to use the default
  925.       MSS of 536 bytes for every request.  To avoid this constraint, a
  926.       T/TCP may cache the MSS option values received from remote hosts,
  927.       and we allow a TCP to use a cached MSS option value for the
  928.       initial SYN segment.
  929.  
  930.       When the client sends an initial <SYN> segment containing data, it
  931.       does not have a send window for the server host.  This is not a
  932.       great difficulty; we simply define a default initial window; our
  933.       current suggestion is 4K.  Such a non-zero default should be be
  934.       conditioned upon the existence of a cached connection count for
  935.       the foreign host, so that data may be included on an initial SYN
  936.       segment only if cache.CC[foreign host] is non-zero.
  937.  
  938.       In TCP, the window is dynamically adjusted to provide congestion
  939.       control/avoidance [Jacobson88].  It is possible that a particular
  940.       path might not be able to absorb an initial burst of 4096 bytes
  941.       without congestive losses.  If this turns out to be a problem, it
  942.       should be possible to cache the congestion threshold for the path
  943.       and use this value to determine the maximum size of the initial
  944.       packet burst created by a request.
  945.  
  946.    3.2  New TCP Options
  947.  
  948.       Three new TCP options are defined: CC, CC.NEW, and CC.ECHO.  Each
  949.       carries a connection count SEG.CC.  The complete rules for sending
  950.       and processing these options are given in Section 3.4 below.
  951.  
  952.  
  953.  
  954. Braden                                                         [Page 17]
  955.  
  956. RFC 1644                    Transaction/TCP                    July 1994
  957.  
  958.  
  959.       CC Option
  960.  
  961.          Kind: 11
  962.  
  963.          Length: 6
  964.  
  965.             +--------+--------+--------+--------+--------+--------+
  966.             |00001011|00000110|    Connection Count:  SEG.CC      |
  967.             +--------+--------+--------+--------+--------+--------+
  968.              Kind=11  Length=6
  969.  
  970.          This option may be sent in an initial SYN segment, and it may
  971.          be sent in other segments if a CC or CC.NEW option has been
  972.          received for this incarnation of the connection.  Its SEG.CC
  973.          value is the TCB.CCsend value from the sender's TCB.
  974.  
  975.       CC.NEW Option
  976.  
  977.          Kind: 12
  978.  
  979.          Length: 6
  980.  
  981.             +--------+--------+--------+--------+--------+--------+
  982.             |00001100|00000110|    Connection Count:  SEG.CC      |
  983.             +--------+--------+--------+--------+--------+--------+
  984.              Kind=12  Length=6
  985.  
  986.          This option may be sent instead of a CC option in an initial
  987.          <SYN> segment (i.e., SYN but not ACK bit), to indicate that the
  988.          SEG.CC value may not be larger than the previous value.  Its
  989.          SEG.CC value is the TCB.CCsend value from the sender's TCB.
  990.  
  991.       CC.ECHO Option
  992.  
  993.          Kind: 13
  994.  
  995.          Length: 6
  996.  
  997.             +--------+--------+--------+--------+--------+--------+
  998.             |00001101|00000110|    Connection Count:  SEG.CC      |
  999.             +--------+--------+--------+--------+--------+--------+
  1000.              Kind=13  Length=6
  1001.  
  1002.          This option must be sent (in addition to a CC option) in a
  1003.          segment containing both a SYN and an ACK bit, if the initial
  1004.          SYN segment contained a CC or CC.NEW option.  Its SEG.CC value
  1005.          is the SEG.CC value from the initial SYN.
  1006.  
  1007.  
  1008.  
  1009.  
  1010. Braden                                                         [Page 18]
  1011.  
  1012. RFC 1644                    Transaction/TCP                    July 1994
  1013.  
  1014.  
  1015.          A CC.ECHO option should be sent only in a <SYN,ACK> segment and
  1016.          should be ignored if it is received in any other segment.
  1017.  
  1018.    3.3  Connection States
  1019.  
  1020.       T/TCP requires new connection states and state transitions.
  1021.       Figure 8 shows the resulting finite state machine; see [RFC-1379]
  1022.       for a detailed development.  If all state names ending in stars
  1023.       are removed from Figure 8, the state diagram reduces to the
  1024.       standard TCP state machine (see Figure 6 of [STD-007]), with two
  1025.       exceptions:
  1026.  
  1027.       *    STD-007 shows a direct transition from SYN-RECEIVED to FIN-
  1028.            WAIT-1 state when the user issues a CLOSE call.  This
  1029.            transition is suspect; a more accurate description of the
  1030.            state machine would seem to require the intermediate SYN-
  1031.            RECEIVED* state shown in Figure 8.
  1032.  
  1033.       *    In STD-007, a user CLOSE call in SYN-SENT state causes a
  1034.            direct transition to CLOSED state.  The extended diagram of
  1035.            Figure 8 forces the connection to open before it closes,
  1036.            since calling CLOSE to terminate the request in SYN-SENT
  1037.            state is normal behavior for a transaction client.  In the
  1038.            case that no data has been sent in SYN-SENT state, it is
  1039.            reasonable for a user CLOSE call to immediately enter CLOSED
  1040.            state and delete the TCB.
  1041.  
  1042.       Each of the new states in Figure 8 bears a starred name, created
  1043.       by suffixing a star onto a standard TCP state.  Each "starred"
  1044.       state bears a simple relationship to the corresponding "unstarred"
  1045.       state.
  1046.  
  1047.       o    SYN-SENT* and SYN-RECEIVED* differ from the SYN-SENT and
  1048.            SYN-RECEIVED state, respectively, in recording the fact that
  1049.            a FIN needs to be sent.
  1050.  
  1051.       o    The other starred states indicate that the connection is
  1052.            half-synchronized (hence, a SYN bit needs to be sent).
  1053.  
  1054.  
  1055.  
  1056.  
  1057.  
  1058.  
  1059.  
  1060.  
  1061.  
  1062.  
  1063.  
  1064.  
  1065.  
  1066. Braden                                                         [Page 19]
  1067.  
  1068. RFC 1644                    Transaction/TCP                    July 1994
  1069.  
  1070.  
  1071.       ________      g        ________
  1072.      |        |<------------|        |
  1073.      | CLOSED |------------>| LISTEN |
  1074.      |________|  h    ------|________|
  1075.           |          /        |     |
  1076.           |         /        i|    j|
  1077.           |        /          |     |
  1078.          a|     a'/           |    _V______               ________
  1079.           |      /     j      |   |ESTAB-  |       e'    | CLOSE- |
  1080.           |     /  -----------|-->| LISHED*|------------>|   WAIT*|
  1081.           |    /  /           |   |________|             |________|
  1082.           |   /  /            |    |     |                |     |
  1083.           |  /  /             |    |    c|              d'|    c|
  1084.       ____V_V_ /       _______V    |   __V_____           |   __V_____
  1085.      | SYN-   |   b'  |  SYN-  |c  |  |ESTAB-  |  e       |  | CLOSE- |
  1086.      |   SENT |------>|RECEIVED|---|->|  LISHED|----------|->|   WAIT |
  1087.      |________|       |________|   |  |________|          |  |________|
  1088.         |               |          |     |                |        |
  1089.         |               |          |     |              __V_____   |
  1090.         |               |          |     |             | LAST-  |  |
  1091.       d'|             d'|        d'|    d|             |  ACK*  |  |
  1092.         |               |          |     |             |________|  |
  1093.         |               |          |     |                    |    |
  1094.         |               |    ______V_    |        ________    |c'  |d
  1095.         |          k    |   |  FIN-  |   |  e''' |        |   |    |
  1096.         |        -------|-->| WAIT-1*|---|------>|CLOSING*|   |    |
  1097.         |       /       |   |________|   |       |________|   |    |
  1098.         |      /        |          |     |            |       |    |
  1099.         |     /         |        c'|     |          c'|       |    |
  1100.      ___V___ /      ____V___       V_____V_       ____V___    V____V__
  1101.     | SYN-   | b'' |  SYN-  |  c  |  FIN-  | e'' |        |  | LAST-  |
  1102.     |  SENT* |---->|RECEIVD*|---->| WAIT-1 |---->|CLOSING |  |   ACK  |
  1103.     |________|     |________|     |________|     |________|  |________|
  1104.                                         |               |           |
  1105.                                        f|              f|         f'|
  1106.                                      ___V____       ____V___     ___V____
  1107.                                     |  FIN-  | e   |TIME-   | T |        |
  1108.                                     | WAIT-2 |---->|   WAIT |-->| CLOSED |
  1109.                                     |________|     |________|   |________|
  1110.  
  1111.  
  1112.                  Figure 8A: Basic T/TCP State Diagram
  1113.  
  1114.  
  1115.  
  1116.  
  1117.  
  1118.  
  1119.  
  1120.  
  1121.  
  1122. Braden                                                         [Page 20]
  1123.  
  1124. RFC 1644                    Transaction/TCP                    July 1994
  1125.  
  1126.  
  1127.     ________________________________________________________________
  1128.    |                                                                |
  1129.    |        Label          Event / Action                           |
  1130.    |        _____          ________________________                 |
  1131.    |                                                                |
  1132.    |          a            Active OPEN / create TCB, snd SYN        |
  1133.    |          a'           Active OPEN / snd SYN                    |
  1134.    |          b            rcv SYN [no TAO]/ snd ACK(SYN)           |
  1135.    |          b'           rcv SYN [no TAO]/ snd SYN,ACK(SYN)       |
  1136.    |          b''          rcv SYN [no TAO]/ snd SYN,FIN,ACK(SYN)   |
  1137.    |          c            rcv ACK(SYN) /                           |
  1138.    |          c'           rcv ACK(SYN) / snd FIN                   |
  1139.    |          d            CLOSE / snd FIN                          |
  1140.    |          d'           CLOSE / snd SYN,FIN                      |
  1141.    |          e            rcv FIN / snd ACK(FIN)                   |
  1142.    |          e'           rcv FIN / snd SYN,ACK(FIN)               |
  1143.    |          e''          rcv FIN / snd FIN,ACK(FIN)               |
  1144.    |          e'''         rcv FIN / snd SYN,FIN,ACK(FIN)           |
  1145.    |          f            rcv ACK(FIN) /                           |
  1146.    |          f'           rcv ACK(FIN) / delete TCB                |
  1147.    |          g            CLOSE / delete TCB                       |
  1148.    |          h            passive OPEN / create TCB                |
  1149.    |          i (= b')     rcv SYN [no TAO]/ snd SYN,ACK(SYN)       |
  1150.    |          j            rcv SYN [TAO OK] / snd SYN,ACK(SYN)      |
  1151.    |          k            rcv SYN [TAO OK] / snd SYN,FIN,ACK(SYN)  |
  1152.    |          T            timeout=2MSL / delete TCB                |
  1153.    |                                                                |
  1154.    |                                                                |
  1155.    |          Figure 8B.  Definition of State Transitions           |
  1156.    |________________________________________________________________|
  1157.  
  1158.       This simple correspondence leads to an alternative state model,
  1159.       which makes it easy to incorporate the new states in an existing
  1160.       implementation.  Each state in the extended FSM is defined by the
  1161.       triplet:
  1162.  
  1163.           (old_state, SENDSYN, SENDFIN)
  1164.  
  1165.       where 'old_state' is a standard TCP state and SENDFIN and SENDSYN
  1166.       are Boolean flags see Figure 9.  The SENDFIN flag is turned on (on
  1167.       the client side) by a SEND(...  EOF=YES) call, to indicate that a
  1168.       FIN should be sent in a state which would not otherwise send a
  1169.       FIN.  The SENDSYN flag is turned on when the TAO test succeeds to
  1170.       indicate that the connection is only half synchronized; as a
  1171.       result, a SYN will be sent in a state which would not otherwise
  1172.       send a SYN.
  1173.  
  1174.  
  1175.  
  1176.  
  1177.  
  1178. Braden                                                         [Page 21]
  1179.  
  1180. RFC 1644                    Transaction/TCP                    July 1994
  1181.  
  1182.  
  1183.        ________________________________________________________________
  1184.       |                                                                |
  1185.       |   New state:         Old_state:    SENDSYN:      SENDFIN:      |
  1186.       |  __________         __________      ______        ______       |
  1187.       |                                                                |
  1188.       |  SYN-SENT*     =>   SYN-SENT        FALSE          TRUE        |
  1189.       |                                                                |
  1190.       |  SYN-RECEIVED* =>   SYN-RECEIVED    FALSE          TRUE        |
  1191.       |                                                                |
  1192.       |  ESTABLISHED*  =>   ESTABLISHED      TRUE         FALSE        |
  1193.       |                                                                |
  1194.       |  CLOSE-WAIT*   =>   CLOSE-WAIT       TRUE         FALSE        |
  1195.       |                                                                |
  1196.       |  LAST-ACK*     =>   LAST-ACK         TRUE         FALSE        |
  1197.       |                                                                |
  1198.       |  FIN-WAIT-1*   =>   FIN-WAIT-1       TRUE         FALSE        |
  1199.       |                                                                |
  1200.       |  CLOSING*      =>   CLOSING          TRUE         FALSE        |
  1201.       |                                                                |
  1202.       |                                                                |
  1203.       |           Figure 9: Alternative State Definitions              |
  1204.       |________________________________________________________________|
  1205.  
  1206.  
  1207.       Here is a more complete description of these boolean variables.
  1208.  
  1209.       *    SENDFIN
  1210.  
  1211.            SENDFIN is turned on by the SEND(...EOF=YES) call, and turned
  1212.            off when FIN-WAIT-1 state is entered.  It may only be on in
  1213.            SYN-SENT* and SYN-RECEIVED* states.
  1214.  
  1215.            SENDFIN has two effects.  First, it causes a FIN to be sent
  1216.            on the last segment of data from the user.  Second, it causes
  1217.            the SYN-SENT[*] and SYN-RECEIVED[*] states to transition
  1218.            directly to FIN-WAIT-1, skipping ESTABLISHED state.
  1219.  
  1220.       *    SENDSYN
  1221.  
  1222.            The SENDSYN flag is turned on when an initial SYN segment is
  1223.            received and passes the TAO test.  SENDSYN is turned off when
  1224.            the SYN is acknowledged (specifically, when there is no RST
  1225.            or SYN bit and SEG.UNA < SND.ACK).
  1226.  
  1227.            SENDSYN has three effects.  First, it causes the SYN bit to
  1228.            be set in segments sent with the initial sequence number
  1229.            (ISN).  Second, it causes a transition directly from LISTEN
  1230.            state to ESTABLISHED*, if there is no FIN bit, or otherwise
  1231.  
  1232.  
  1233.  
  1234. Braden                                                         [Page 22]
  1235.  
  1236. RFC 1644                    Transaction/TCP                    July 1994
  1237.  
  1238.  
  1239.            to CLOSE-WAIT*.  Finally, it allows data to be received and
  1240.            processed (passed to the application) even if the segment
  1241.            does not contain an ACK bit.
  1242.  
  1243.       According to the state model of the basic TCP specification [STD-
  1244.       007], the server side must explicitly issued a passive OPEN call,
  1245.       creating a TCB in LISTEN state, before an initial SYN may be
  1246.       accepted.  To accommodate truncation of TIME-WAIT state within
  1247.       this model, it is necessary to add the five "I-states" shown in
  1248.       Figure 10.  The I-states are:  LISTEN-LA, LISTEN-LA*, LISTEN-CL,
  1249.       LISTEN-CL*, and LISTEN-TW.  These are 'bridge states' between two
  1250.       successive the state diagrams of two successive incarnations.
  1251.       Here D is the duration of the previous connection, i.e., the
  1252.       elapsed time since the connection opened.  The transitions labeled
  1253.       with lower-case letters are taken from Figure 8.
  1254.  
  1255.       Fortunately, many TCP implementations have a different user
  1256.       interface model, in which the use can issue a generic passive open
  1257.       ("listen") call; thereafter, when a matching initial SYN arrives,
  1258.       a new TCB in LISTEN state is automatically generated.  With this
  1259.       user model, the I-states of Figure 10 are unnecessary.
  1260.  
  1261.       For example, suppose an initial SYN segment arrives for a
  1262.       connection that is in LAST-ACK state.  If this segment carries a
  1263.       CC option and if SEG.CC is greater than TCB.CCrecv in the existing
  1264.       TCB, the "q" transition shown in Figure 10 can be made directly
  1265.       from the LAST-ACK state.  That is, the previous TCB is processed
  1266.       as if an ACK(FIN) had arrived, causing the user to be notified of
  1267.       a successful CLOSE and the TCB to be deleted.  Then processing of
  1268.       the new SYN segment is repeated, using a new TCB that is generated
  1269.       automatically.  The same principle can be used to avoid
  1270.       implementing any of the I-states.
  1271.  
  1272.  
  1273.  
  1274.  
  1275.  
  1276.  
  1277.  
  1278.  
  1279.  
  1280.  
  1281.  
  1282.  
  1283.  
  1284.  
  1285.  
  1286.  
  1287.  
  1288.  
  1289.  
  1290. Braden                                                         [Page 23]
  1291.  
  1292. RFC 1644                    Transaction/TCP                    July 1994
  1293.  
  1294.  
  1295.  ______________________________
  1296. | P: Passive OPEN /            |
  1297. |                              |
  1298. | Q: Rcv SYN, special TAO test |                     d'|     d|
  1299. |     (see text) / Delete TCB, |    ________        ___V____  |
  1300. |     create TCB, snd SYN      |   |LISTEN- |  P   | LAST-  | |
  1301. |                              |   |   LA*  |<-----|  ACK*  | |
  1302. | Q': (same as Q) if D < MSL   |   |________|      |________| |
  1303. |                              |    |     |            |      |
  1304. | R: Rcv ACK(FIN) / Delete TCB,|   Q|   c'|          c'|      |
  1305. |     create TCB               |    |     |            |      |
  1306. |                              |    |  ___V____        V______V
  1307. | S': Active OPEN if D < MSL / |    | |LISTEN- |  P   | LAST-  |
  1308. |     Delete TCB, create TCB,  |    | |  LA    |<-----|   ACK  |
  1309. |     snd SYN.                 |    | |________|      |________|
  1310. |______________________________|    |  |     |            |
  1311.                                     | Q|    R|           f|
  1312.          ________        ________   |  |     |            |
  1313.    e''' |        |  P   |LISTEN- |  |  |     V            V
  1314.    ---->|CLOSING*|----->|   CL*  |  |  |   LISTEN       CLOSED
  1315.         |________|      |________|  |  |
  1316.              |            |   Q|    |  |
  1317.            c'|          c'|    V    V  V
  1318.              |            |   ESTABLISHED*
  1319.          ____V___         V_______
  1320.     e'' |        |  P    |LISTEN- |
  1321.    ---->|CLOSING |------>|   CL   |
  1322.         |________|       |________|
  1323.              |           R|     Q|
  1324.             f|            V      V
  1325.              |         LISTEN   ESTABLISHED*
  1326.          ____V___                _________
  1327.      e  |TIME-   |  P           | LISTEN- |
  1328.    ---->|   WAIT |------------->|    TW   |
  1329.         |________|              |_________|
  1330.         /     |                  |    |  |
  1331.      S'/     T|                 T|  Q'|  |S'
  1332.       |  _____V_      h     _____V__  |  V
  1333.       | |        |-------->|        | |  SYN-SENT
  1334.       | | CLOSED |<--------| LISTEN | |
  1335.       | |________|   ------|________| |
  1336.       |   |        /        |   j|    |
  1337.       |  a|     a'/        i|    V    V
  1338.       |   |      /          |   ESTABLISHED*
  1339.       V   V     V           V
  1340.         SYN-SENT           ...
  1341.  
  1342.              Figure 10: I-States for TIME-WAIT Truncation
  1343.  
  1344.  
  1345.  
  1346. Braden                                                         [Page 24]
  1347.  
  1348. RFC 1644                    Transaction/TCP                    July 1994
  1349.  
  1350.  
  1351.    3.4  T/TCP Processing Rules
  1352.  
  1353.       This section summarizes the rules for sending and processing the
  1354.       T/TCP options.
  1355.  
  1356.       INITIALIZATION
  1357.  
  1358.          I1:  All cache entries cache.CC[*] and cache.CCsent[*] are
  1359.               undefined (zero) when a host system initializes, and CCgen
  1360.               is set to a non-zero value.
  1361.  
  1362.          I2:  A new TCB is initialized with TCB.CCrecv = 0 and
  1363.               TCB.CCsend = current CCgen value; CCgen is then
  1364.               incremented.  If the result is zero, CCgen is incremented
  1365.               again.
  1366.  
  1367.  
  1368.       SENDING SEGMENTS
  1369.  
  1370.          S1:  Sending initial <SYN> Segment
  1371.  
  1372.               An initial <SYN> segment is sent with either a CC option
  1373.               or a CC.NEW option.  If cache.CCsent[fh] is undefined or
  1374.               if TCB.CCsend < cache.CCsent[fh], then the option
  1375.               CC.NEW(TCB.CCsend) is sent and cache.CCsent[fh] is set to
  1376.               zero.  Otherwise, the option CC(TCB.CCsend) is sent and
  1377.               cache.CCsent[fh] is set to CCsend.
  1378.  
  1379.          S2:  Sending <SYN,ACK> Segment
  1380.  
  1381.               If the sender's TCB.CCrecv is non-zero, then a <SYN,ACK>
  1382.               segment is sent with both a CC(TCB.CCsend) option and a
  1383.               CC.ECHO (TCB.CCrecv) option.
  1384.  
  1385.          S3:  Sending Non-SYN Segment
  1386.  
  1387.               A non-SYN segment is sent with a CC(TCB.CCsend) option if
  1388.               the TCB.CCrecv value is non-zero, or if the state is SYN-
  1389.               SENT or SYN-SENT* and cache.CCsent[fh] is non-zero (this
  1390.               last is required to send CC options in the segments
  1391.               following the first of a multi-segment request message;
  1392.               see segment #2 in Figure 6).
  1393.  
  1394.       RECEIVING INITIAL <SYN> SEGMENT
  1395.  
  1396.          Suppose that a server host receives a segment containing a SYN
  1397.          bit but no ACK bit in LISTEN, SYN-SENT, or SYN-SENT* state.
  1398.  
  1399.  
  1400.  
  1401.  
  1402. Braden                                                         [Page 25]
  1403.  
  1404. RFC 1644                    Transaction/TCP                    July 1994
  1405.  
  1406.  
  1407.          R1.1:If the <SYN> segment contains a CC or CC.NEW option,
  1408.               SEG.CC is stored into TCB.CCrecv of the new TCB.
  1409.  
  1410.          R1.2:If the segment contains a CC option and if the local cache
  1411.               entry cache.CC[fh] is defined and if
  1412.               SEG.CC > cache.CC[fh], then the TAO test is passed and the
  1413.               connection is half-synchronized in the incoming direction.
  1414.               The server host replaces the cache.CC[fh] value by SEG.CC,
  1415.               passes any data in the segment to the user, and processes
  1416.               a FIN bit if present.
  1417.  
  1418.               Acknowledgment of the SYN is delayed to allow piggybacking
  1419.               on a response segment.
  1420.  
  1421.          R1.3:If SEG.CC <= cache.CC[fh] (the TAO test has failed), or if
  1422.               cache.CC[fh] is undefined, or if there is no CC option
  1423.               (but possibly a CC.NEW option), the server host proceeds
  1424.               with normal TCP processing.  If the connection was in
  1425.               LISTEN state, then the host executes a 3-way handshake
  1426.               using the standard TCP rules.  In the SYN-SENT or SYN-
  1427.               SENT* state (i.e., the simultaneous open case), the TCP
  1428.               sends ACK(SYN) and enters SYN-RECEIVED state.
  1429.  
  1430.          R1.4:If there is no CC option (but possibly a CC.NEW option),
  1431.               then the server host sets cache.CC[fh] undefined (zero).
  1432.               Receiving an ACK for a SYN (following application of rule
  1433.               R1.3) will update cache.CC[fh], by rule R3.
  1434.  
  1435.          Suppose that an initial <SYN> segment containing a CC or CC.NEW
  1436.          option arrives in an I-state (i.e., a state with a name of the
  1437.          form 'LISTEN-xx', where xx is one of TW, LA, L8, CL, or CL*):
  1438.  
  1439.          R1.5:If the state is LISTEN-TW, then the duration of the
  1440.               current connection is compared with MSL.  If duration >
  1441.               MSL then send a RST:
  1442.  
  1443.                 <SEQ=0><ACK=SEG.SEQ+SEG.LEN><CTL=RST,ACK>
  1444.  
  1445.               drop the packet, and return.
  1446.  
  1447.          R1.6:Perform a special TAO test: compare SEG.CC with
  1448.               TCB.CCrecv.
  1449.  
  1450.               If SEG.CC is greater, then processing is performed as if
  1451.               an ACK(FIN) had arrived:  signal the application that the
  1452.               previous close completed successfully and delete the
  1453.               previous TCB.  Then create a new TCB in LISTEN state and
  1454.               reprocess the SYN segment against the new TCB.
  1455.  
  1456.  
  1457.  
  1458. Braden                                                         [Page 26]
  1459.  
  1460. RFC 1644                    Transaction/TCP                    July 1994
  1461.  
  1462.  
  1463.               Otherwise, silently discard the segment.
  1464.  
  1465.       RECEIVING <SYN,ACK> SEGMENT
  1466.  
  1467.          Suppose that a client host receives a <SYN,ACK> segment for a
  1468.          connection in SYN-SENT or SYN-SENT* state.
  1469.  
  1470.          R2.1:If SEG.ACK is not acceptable (see [STD-007]) and
  1471.               cache.CCsent[fh] is non-zero, then simply drop the segment
  1472.               without sending a RST.  (The new SYN that the client is
  1473.               (re-)transmitting will eventually acknowledge any
  1474.               outstanding data and FIN at the server.)
  1475.  
  1476.          R2.2:If the segment contains a CC.ECHO option whose SEG.CC is
  1477.               different from TCB.CCsend, then the segment is
  1478.               unacceptable and is dropped.
  1479.  
  1480.          R2.3:If cache.CCsent[fh] is zero, then it is set to TCB.CCsend.
  1481.  
  1482.          R2.4:If the segment contains a CC option, its SEG.CC is stored
  1483.               into TCB.CCrecv of the TCB.
  1484.  
  1485.       RECEIVING <ACK> SEGMENT IN SYN-RECEIVED STATE
  1486.  
  1487.          R3.1:If a segment contains a CC option whose SEG.CC differs
  1488.               from TCB.CCrecv, then the segment is unacceptable and is
  1489.               dropped.
  1490.  
  1491.          R3.2:Otherwise, a 3-way handshake has completed successfully at
  1492.               the server side.  If the segment contains a CC option and
  1493.               if cache.CC[fh] is zero, then cache.CC[fh] is replaced by
  1494.               TCB.CCrecv.
  1495.  
  1496.       RECEIVING OTHER SEGMENT
  1497.  
  1498.          R4:  Any other segment received with a CC option is
  1499.               unacceptable if SEG.CC differs from TCB.CCrecv.  However,
  1500.               a RST segment is exempted from this test.
  1501.  
  1502.       OPEN REQUEST
  1503.  
  1504.          To allow truncation of TIME-WAIT state, the following changes
  1505.          are made in the state diagram for OPEN requests (see Figure
  1506.          10):
  1507.  
  1508.          O1.1:A new passive open request is allowed in any of the
  1509.               states: LAST-ACK, LAST-ACK*, CLOSING, CLOSING*, or TIME-
  1510.               WAIT.  This causes a transition to the corresponding I-
  1511.  
  1512.  
  1513.  
  1514. Braden                                                         [Page 27]
  1515.  
  1516. RFC 1644                    Transaction/TCP                    July 1994
  1517.  
  1518.  
  1519.               state (see Figure 10), which retains the previous state,
  1520.               including the retransmission queue and timer.
  1521.  
  1522.          O1.2 A new active open request is allowed in TIME-WAIT or
  1523.               LISTEN-TW state, if the elapsed time since the current
  1524.               connection opened is less than MSL.  The result is to
  1525.               delete the old TCB and create a new one, send a new SYN
  1526.               segment, and enter SYN-SENT or SYN-SENT* state (depending
  1527.               upon whether or not the SYN segment contains a FIN bit).
  1528.  
  1529.       Finally, T/TCP has a provision to improve performance for the case
  1530.       of a client that "sprays" transactions rapidly using many
  1531.       different server hosts and/or ports.  If TCB.CCrecv in the TCB is
  1532.       non-zero (and still assuming that the connection duration is less
  1533.       than MSL), then the TIME-WAIT delay may be set to min(K*RTO,
  1534.       2*MSL).  Here RTO is the measured retransmission timeout time and
  1535.       the constant K is currently specified to be 8.
  1536.  
  1537.    3.5  User Interface
  1538.  
  1539.       STD-007 defines a prototype user interface ("transport service")
  1540.       that implements the virtual circuit service model [STD-007,
  1541.       Section 3.8].  One addition to this interface in required for
  1542.       transaction processing: a new Boolean flag "end-of-file" (EOF),
  1543.       added to the SEND call.  A generic SEND call becomes:
  1544.  
  1545.         Send
  1546.  
  1547.           Format:  SEND (local connection name, buffer address,
  1548.                byte count, PUSH flag, URGENT flag, EOF flag [,timeout])
  1549.  
  1550.       The following text would be added to the description of SEND in
  1551.       [STD-007]:
  1552.  
  1553.           If the EOF (End-Of-File) flag is set, any remaining queued
  1554.           data is pushed and the connection is closed.  Just as with the
  1555.           CLOSE call, all data being sent is delivered reliably before
  1556.           the close takes effect, and data may continue to be received
  1557.           on the connection after completion of the SEND call.
  1558.  
  1559.       Figure 8A shows a skeleton sequence of user calls by which a
  1560.       client could initiate a transaction.  The SEND call initiates a
  1561.       transaction request to the foreign socket (host and port)
  1562.       specified in the passive OPEN call.  The predicate "recv_EOF"
  1563.       tests whether or not a FIN has been received on the connection;
  1564.       this might be implemented using the STATUS command of [STD-007],
  1565.       or it might be implemented by some operating-system-dependent
  1566.       mechanism.  When recv_EOF returns TRUE, the connection has been
  1567.  
  1568.  
  1569.  
  1570. Braden                                                         [Page 28]
  1571.  
  1572. RFC 1644                    Transaction/TCP                    July 1994
  1573.  
  1574.  
  1575.       completely closed and the client end of the connection is in
  1576.       TIME-WAIT state.
  1577.  
  1578.      __________________________________________________________________
  1579.     |                                                                  |
  1580.     |                                                                  |
  1581.     | OPEN(local_port, foreign_socket, PASSIVE) -> conn_name;          |
  1582.     |                                                                  |
  1583.     | SEND(conn_name, request_buffer, length,                          |
  1584.     |                                    PUSH=YES, URG=NO, EOF=YES);   |
  1585.     |                                                                  |
  1586.     | while (not recv_EOF(conn_name)) {                                |
  1587.     |                                                                  |
  1588.     |    RECEIVE(conn_name, reply_buffer, length) -> count;            |
  1589.     |                                                                  |
  1590.     |    <Process reply_buffer.>                                       |
  1591.     | }                                                                |
  1592.     |                                                                  |
  1593.     |                                                                  |
  1594.     |             Figure 8A: Client Side User Interface                |
  1595.     |__________________________________________________________________|
  1596.  
  1597.       If a client is going to send a rapid series of such requests to
  1598.       the same foreign_socket, it should use the same local_port for
  1599.       all.  This will allow truncation of TIME-WAIT state.  Otherwise,
  1600.       it could leave local_port wild, allowing TCP to choose successive
  1601.       local ports for each call, realizing that each transaction may
  1602.       leave behind a significant control block overhead in the kernel.
  1603.  
  1604.       Figure 8B shows a basic sequence of server calls.  The server
  1605.       application waits for a request to arrive and then reads and
  1606.       processes it until a FIN arrives (recv_EOF returns TRUE).  At this
  1607.       time, the connection is half-closed.  The SEND call used to return
  1608.       the reply completes the close in the other direction.  It should
  1609.       be noted that the use of SEND(... EOF=YES) in Figure 4B instead of
  1610.       a SEND, CLOSE sequence is only an optimization; it allows
  1611.       piggybacking the FIN in order to minimize the number of segments.
  1612.       It should have little effect on transaction latency.
  1613.  
  1614.  
  1615.  
  1616.  
  1617.  
  1618.  
  1619.  
  1620.  
  1621.  
  1622.  
  1623.  
  1624.  
  1625.  
  1626. Braden                                                         [Page 29]
  1627.  
  1628. RFC 1644                    Transaction/TCP                    July 1994
  1629.  
  1630.  
  1631.      __________________________________________________________________
  1632.     |                                                                  |
  1633.     |                                                                  |
  1634.     | OPEN(local_port, ANY_SOCKET, PASSIVE) -> conn_name;              |
  1635.     |                                                                  |
  1636.     | <Wait for connection to open.>                                   |
  1637.     |                                                                  |
  1638.     | STATUS(conn_name) -> foreign_socket                              |
  1639.     |                                                                  |
  1640.     | while (not recv_EOF(conn_name)) {                                |
  1641.     |                                                                  |
  1642.     |    RECEIVE(conn_name, request_buffer, length) -> count;          |
  1643.     |                                                                  |
  1644.     |     <Process request_buffer.>                                    |
  1645.     | }                                                                |
  1646.     |                                                                  |
  1647.     | <Compute reply and store into reply_buffer.>                     |
  1648.     |                                                                  |
  1649.     | SEND(conn_name, reply_buffer, length,                            |
  1650.     |                                  PUSH=YES, URG=NO, EOF=YES);     |
  1651.     |                                                                  |
  1652.     |                                                                  |
  1653.     |             Figure 8B: Server Side User Interface                |
  1654.     |__________________________________________________________________|
  1655.  
  1656.  
  1657. 4.  IMPLEMENTATION ISSUES
  1658.  
  1659.    4.1  RFC-1323 Extensions
  1660.  
  1661.       A recently-proposed set of TCP enhancements [RFC-1323] defines a
  1662.       Timestamps option, which carries two 32-bit timestamp values.
  1663.       This option is used to accurately measure round-trip time (RTT).
  1664.       The same option is also used in a procedure known as "PAWS"
  1665.       (Protect Against Wrapped Sequence) to prevent erroneous data
  1666.       delivery due to a combination of old duplicate segments and
  1667.       sequence number reuse at very high bandwidths.  The approach to
  1668.       transactions specified in this memo is independent of the RFC-1323
  1669.       enhancements, but implementation of RFC-1323 is desirable for all
  1670.       TCP's.
  1671.  
  1672.       The RFC-1323 extensions share several common implementation issues
  1673.       with the T/TCP extensions.  Both require that TCP headers carry
  1674.       options.  Accommodating options in TCP headers requires changes in
  1675.       the way that the maximum segment size is determined, to prevent
  1676.       inadvertent IP fragmentation.  Both require some additional state
  1677.       variable in the TCB, which may or may not cause implementation
  1678.       difficulties.
  1679.  
  1680.  
  1681.  
  1682. Braden                                                         [Page 30]
  1683.  
  1684. RFC 1644                    Transaction/TCP                    July 1994
  1685.  
  1686.  
  1687.    4.2  Minimal Packet Sequence
  1688.  
  1689.       Most TCP implementations will require some small modifications to
  1690.       allow the minimal packet sequence for a transaction shown in
  1691.       Figure 2.
  1692.  
  1693.       Many TCP implementations contain a mechanism to delay
  1694.       acknowledgments of some subset of the data segments, to cut down
  1695.       on the number of acknowledgment segments and to allow piggybacking
  1696.       on the reverse data flow (typically character echoes).  To obtain
  1697.       minimal packet exchanges for transactions, it is necessary to
  1698.       delay the acknowledgment of some control bits, in an analogous
  1699.       manner.  In particular, the <SYN,ACK> segment that is to be sent
  1700.       in ESTABLISHED* or CLOSE-WAIT* state should be delayed.  Note that
  1701.       the amount of delay is determined by the minimum RTO at the
  1702.       transmitter; it is a parameter of the communication protocol,
  1703.       independent of the application.  We propose to use the same delay
  1704.       parameter (and if possible, the same mechanism) that is used for
  1705.       delaying data acknowledgments.
  1706.  
  1707.       To get the FIN piggy-backed on the reply data (segment #3 in
  1708.       Figure 2), thos implementations that have an implied PUSH=YES on
  1709.       all SEND calls will need to augment the user interface so that
  1710.       PUSH=NO can be set for transactions.
  1711.  
  1712.    4.3  RTT Measurement
  1713.  
  1714.       Transactions introduce new issues into the problem of measuring
  1715.       round trip times [Jacobson88].
  1716.  
  1717.       (a)  With the minimal 3-segment exchange, there can be exactly one
  1718.            RTT measurement in each direction for each transaction.
  1719.            Since dynamic estimation of RTT cannot take place within a
  1720.            single transaction, it must take place across successive
  1721.            transactions.  Therefore, cacheing the measured RTT and RTT
  1722.            variance values is essential for transaction processing; in
  1723.            normal virtual circuit communication, such cacheing is only
  1724.            desirable.
  1725.  
  1726.       (b)  At the completion of a transaction, the values for RTT and
  1727.            RTT variance that are retained in the cache must be some
  1728.            average of previous values with the values measured during
  1729.            the transaction that is completing.  This raises the question
  1730.            of the time constant for this average; quite different
  1731.            dynamic considerations hold for transactions than for file
  1732.            transfers, for example.
  1733.  
  1734.       (c)  An RTT measurement by the client will yield the value:
  1735.  
  1736.  
  1737.  
  1738. Braden                                                         [Page 31]
  1739.  
  1740. RFC 1644                    Transaction/TCP                    July 1994
  1741.  
  1742.  
  1743.                   T = RTT + min(SPT, ATO),
  1744.  
  1745.            where SPT (server processing time) was defined in the
  1746.            introduction, and ATO is the timeout period for sending a
  1747.            delayed ACK.  Thus, the measured RTT includes SPT, which may
  1748.            be arbitrarily variable; however, the resulting variability
  1749.            of the measured T cannot exceed ATO. (In a popular TCP
  1750.            implementation, for example, ATO = 200ms, so that the
  1751.            variance of SPT makes a relatively small contribution to the
  1752.            variance of RTT.)
  1753.  
  1754.       (d)  Transactions sample the RTT at random times, which are
  1755.            determined by the client and the server applications rather
  1756.            than by the network dynamics.  When there are long pauses
  1757.            between transactions, cached path properties will be poor
  1758.            predictors of current values in the network.
  1759.  
  1760.       Thus, the dynamics of RTT measurement for transactions differ from
  1761.       those for virtual circuits.  RTT measurements should work
  1762.       correctly for very short connections but reduce to the current TCP
  1763.       algorithms for long-lasting connections.  Further study is this
  1764.       issue is needed.
  1765.  
  1766.    4.4  Cache Implementation
  1767.  
  1768.       This extension requires a per-host cache of connection counts.
  1769.       This cache may also contain values of the smoothed RTT, RTT
  1770.       variance, congestion avoidance threshold, and MSS values.
  1771.       Depending upon the implementation details, it may be simplest to
  1772.       build a new cache for these values; another possibility is to use
  1773.       the routing cache that should already be included in the host
  1774.       [RFC-1122].
  1775.  
  1776.       Implementation of the cache may be simplified because it is
  1777.       consulted only when a connection is established; thereafter, the
  1778.       CC values relevant to the connection are kept in the TCB.  This
  1779.       means that a cache entry may be safely reused during the lifetime
  1780.       of a connection, avoiding the need for locking.
  1781.  
  1782.    4.5  CPU Performance
  1783.  
  1784.       TCP implementations are customarily optimized for streaming of
  1785.       data at high speeds, not for opening or closing connections.
  1786.       Jacobson's Header Prediction algorithm [Jacobson90] handles the
  1787.       simple common cases of in-sequence data and ACK segments when
  1788.       streaming data.  To provide good performance for transactions, an
  1789.       implementation might be able to do an analogous "header
  1790.       prediction" specifically for the minimal request and the response
  1791.  
  1792.  
  1793.  
  1794. Braden                                                         [Page 32]
  1795.  
  1796. RFC 1644                    Transaction/TCP                    July 1994
  1797.  
  1798.  
  1799.       segments.
  1800.  
  1801.       The overhead of UDP provides a lower bound on the overhead of
  1802.       TCP-based transaction processing.  It will probably not be
  1803.       possible to reach this bound for TCP transactions, since opening a
  1804.       TCP connection involves creating a significant amount of state
  1805.       that is not required by UDP.
  1806.  
  1807.       McKenney and Dove [McKenney92] have pointed out that transaction
  1808.       processing applications of TCP can stress the performance of the
  1809.       demultiplexing algorithm, i.e., the algorithm used to look up the
  1810.       TCB when a segment arrives.  They advocate the use of hash-table
  1811.       techniques rather than a linear search.  The effect of
  1812.       demultiplexing on performance may become especially acute for a
  1813.       transaction client using the extended TCP described here, due to
  1814.       TCB's left in TIME-WAIT state.  A high rate of transactions from a
  1815.       given client will leave a large number of TCB's in TIME-WAIT
  1816.       state, until their timeout expires.  If the TCP implementation
  1817.       uses a linear search for demultiplexing, all of these control
  1818.       blocks must be traversed in order to discover that the new
  1819.       association does not exist.  In this circumstance, performance of
  1820.       a hash table lookup should not degrade severely due to
  1821.       transactions.
  1822.  
  1823.    4.6  Pre-SYN Queue
  1824.  
  1825.       Suppose that segment #1 in Figure 4 is lost in the network; when
  1826.       segment #2 arrives in LISTEN state, it will be ignored by the TCP
  1827.       rules (see [STD-007] p.66, "fourth other text and control"), and
  1828.       must be retransmitted.  It would be possible for the server side
  1829.       to queue any ACK-less data segments received in LISTEN state and
  1830.       to "replay" the segments in this queue when a SYN segment does
  1831.       arrive.  A data segment received with an ACK bit, which is the
  1832.       normal case for existing TCP's, would still a generate RST
  1833.       segment.
  1834.  
  1835.       Note that queueing segments in LISTEN state is different from
  1836.       queueing out-of-order segments after the connection is
  1837.       synchronized.  In LISTEN state, the sequence number corresponding
  1838.       to the left window edge is not yet known, so that the segment
  1839.       cannot be trimmed to fit within the window before it is queued.
  1840.       In fact, no processing should be done on a queued segment while
  1841.       the connection is still in LISTEN state.  Therefore, a new "pre-
  1842.       SYN queue" would be needed.  A timeout would be required, to flush
  1843.       the Pre-SYN Queue in case a SYN segment was not received.
  1844.  
  1845.       Although implementation of a pre-SYN queue is not difficult in BSD
  1846.       TCP, its limited contribution to throughput probably does not
  1847.  
  1848.  
  1849.  
  1850. Braden                                                         [Page 33]
  1851.  
  1852. RFC 1644                    Transaction/TCP                    July 1994
  1853.  
  1854.  
  1855.       justify the effort.
  1856.  
  1857. 6.  ACKNOWLEDGMENTS
  1858.  
  1859.    I am very grateful to Dave Clark for pointing out bugs in RFC-1379
  1860.    and for helping me to clarify the model.  I also wish to thank Greg
  1861.    Minshall, whose probing questions led to further elucidation of the
  1862.    issues in T/TCP.
  1863.  
  1864. 7.  REFERENCES
  1865.  
  1866.     [Jacobson88] Jacobson, V., "Congestion Avoidance and Control", ACM
  1867.       SIGCOMM '88, Stanford, CA, August 1988.
  1868.  
  1869.     [Jacobson90] Jacobson, V., "4BSD Header Prediction", Comp Comm
  1870.       Review, v. 20, no. 2, April 1990.
  1871.  
  1872.     [McKenney92]  McKenney, P., and K. Dove, "Efficient Demultiplexing
  1873.       of Incoming TCP Packets", ACM SIGCOMM '92, Baltimore, MD, October
  1874.       1992.
  1875.  
  1876.     [RFC-1122]  Braden, R., Ed., "Requirements for Internet Hosts --
  1877.       Communications Layers", STD-3, RFC-1122, USC/Information Sciences
  1878.       Institute, October 1989.
  1879.  
  1880.     [RFC-1323]  Jacobson, V., Braden, R., and D. Borman, "TCP Extensions
  1881.       for High Performance, RFC-1323, LBL, USC/Information Sciences
  1882.       Institute, Cray Research, February 1991.
  1883.  
  1884.     [RFC-1379]  Braden, R., "Transaction TCP -- Concepts", RFC-1379,
  1885.       USC/Information Sciences Institute, September 1992.
  1886.  
  1887.     [ShankarLee93]  Shankar, A. and D. Lee, "Modulo-N Incarnation
  1888.       Numbers for Cache-Based Transport Protocols", Report CS-TR-3046/
  1889.       UIMACS-TR-93-24, University of Maryland, March 1993.
  1890.  
  1891.     [STD-007]  Postel, J., "Transmission Control Protocol - DARPA
  1892.       Internet Program Protocol Specification", STD-007, RFC-793,
  1893.       USC/Information Sciences Institute, September 1981.
  1894.  
  1895.  
  1896.  
  1897.  
  1898.  
  1899.  
  1900.  
  1901.  
  1902.  
  1903.  
  1904.  
  1905.  
  1906. Braden                                                         [Page 34]
  1907.  
  1908. RFC 1644                    Transaction/TCP                    July 1994
  1909.  
  1910.  
  1911. APPENDIX A.  ALGORITHM SUMMARY
  1912.  
  1913.    This appendix summarizes the additional processing rules introduced
  1914.    by T/TCP.  We define the following symbols:
  1915.  
  1916.    Options
  1917.  
  1918.        CC(SEG.CC):         TCP Connection Count (CC) Option
  1919.        CC.NEW(SEG.CC):     TCP CC.NEW option
  1920.        CC.ECHO(SEG.CC):    TCP CC.ECHO option
  1921.  
  1922.            Here SEG.CC is option value in segment.
  1923.  
  1924.    Per-Connection State Variables in TCB
  1925.  
  1926.        CCsend:             CC value to be sent in segments
  1927.        CCrecv:             CC value to be received in segments
  1928.        Elapsed:            Duration of connection
  1929.  
  1930.    Global Variables:
  1931.  
  1932.        CCgen:              CC generator variable
  1933.        cache.CC[fh]:       Cache entry: Last CC value received.
  1934.        cache.CCsent[fh]:   Cache entry: Last CC value sent.
  1935.  
  1936.  
  1937.    PSEUDO-CODE SUMMARY:
  1938.  
  1939.    Passive OPEN => {
  1940.        Create new TCB;
  1941.    }
  1942.  
  1943.    Active OPEN => {
  1944.        <Create new TCB>
  1945.        CCrecv = 0;
  1946.        CCsend = CCgen;
  1947.        If (CCgen == 0xffffffff) then Set CCgen = 1;
  1948.                                 else Set CCgen = CCgen + 1.
  1949.        <Send initial {SYN} segment (see below)>
  1950.    }
  1951.  
  1952.  
  1953.    Send initial {SYN} segment => {
  1954.  
  1955.        If (cache.CCsent[fh] == 0 OR CCsend < cache.CCsent[fh] ) then {
  1956.  
  1957.              Include CC.NEW(CCsend) option in segment;
  1958.              Set cache.CCsent[fh] = 0;
  1959.  
  1960.  
  1961.  
  1962. Braden                                                         [Page 35]
  1963.  
  1964. RFC 1644                    Transaction/TCP                    July 1994
  1965.  
  1966.  
  1967.        }
  1968.        else {
  1969.  
  1970.              Include CC(CCsend) option in segment;
  1971.              Set cache.CCsent[fh] = CCsend;
  1972.        }
  1973.     }
  1974.  
  1975.  
  1976.    Send {SYN,ACK} segment => {
  1977.  
  1978.        If (CCrecv != 0) then
  1979.              Include CC(CCsend), CC.ECHO(CCrecv) options in segment.
  1980.    }
  1981.  
  1982.  
  1983.    Receive {SYN} segment in LISTEN, SYN-SENT, or SYN-SENT* state => {
  1984.  
  1985.        If state == LISTEN then {
  1986.              CCrecv = 0;
  1987.              CCsend = CCgen;
  1988.              If (CCgen == 0xffffffff) then Set CCgen = 1;
  1989.                                       else Set CCgen = CCgen + 1.
  1990.        }
  1991.  
  1992.        If (Segment contains CC option  OR
  1993.              Segment contains CC.NEW option) then
  1994.                    Set CCrecv = SEG.CC.
  1995.  
  1996.        if (Segment contains CC option  AND
  1997.              cache.CC[fh] != 0  AND
  1998.                    SEG.CC > cache.CC[fh] ) then {  /* TAO Test OK */
  1999.  
  2000.              Set cache.CC[fh] = CCrecv;
  2001.              <Mark connection half-synchronized>
  2002.              <Process data and/or FIN and return>
  2003.        }
  2004.  
  2005.  
  2006.        If (Segment does not contain CC option)  then
  2007.              Set cache.CC[fh] = 0;
  2008.  
  2009.        <Do normal TCP processing and return>.
  2010.    }
  2011.  
  2012.    Receive {SYN} segment in LISTEN-TW, LISTEN-LA, LISTEN-LA*, LISTEN-CL,
  2013.        or LISTEN-CL* state => {
  2014.  
  2015.  
  2016.  
  2017.  
  2018. Braden                                                         [Page 36]
  2019.  
  2020. RFC 1644                    Transaction/TCP                    July 1994
  2021.  
  2022.  
  2023.        If ( (Segment contains CC option AND CCrecv != 0 )  then  {
  2024.  
  2025.              If (state = LISTEN-TW AND Elapsed > MSL ) then
  2026.                    <Send RST, drop segment, and return>.
  2027.  
  2028.              if (SEG.CC > CCrecv )  then {
  2029.                    <Implicitly ACK FIN and data in retransmission queue>;
  2030.                    <Close and delete TCB>;
  2031.                    <Reprocess segment>.
  2032.                            /* Expect to match new TCB
  2033.                             * in LISTEN state.
  2034.                             */
  2035.               }
  2036.        }
  2037.        else
  2038.              <Drop segment>.
  2039.    }
  2040.  
  2041.  
  2042.    Receive {SYN,ACK} segment => {
  2043.  
  2044.        if (Segment contains CC.ECHO option  AND
  2045.                    SEG.CC != CCsend) then
  2046.              <Send a reset and discard segment>.
  2047.  
  2048.        if (Segment contains CC option) then {
  2049.              Set CCrecv = SEG.CC.
  2050.  
  2051.              if (cache.CC[fh] is undefined) then
  2052.                    Set cache.CC[fh] = CCrecv.
  2053.        }
  2054.    }
  2055.  
  2056.  
  2057.    Send non-SYN segment => {
  2058.  
  2059.        if (CCrecv != 0  OR
  2060.              (cache.CCsent[fh] != 0  AND
  2061.               state is SYN-SENT or SYN-SENT*)) then
  2062.                   Include CC(CCsend) option in segment.
  2063.    }
  2064.  
  2065.  
  2066.    Receive non-SYN segment in SYN-RECEIVED state => {
  2067.  
  2068.        if (Segment contains CC option  AND  RST bit is off) {
  2069.                if (SEG.CC != CCrecv)  then
  2070.                      <Segment is unacceptable; drop it and send an
  2071.  
  2072.  
  2073.  
  2074. Braden                                                         [Page 37]
  2075.  
  2076. RFC 1644                    Transaction/TCP                    July 1994
  2077.  
  2078.  
  2079.                        ACK segment, as in normal TCP processing>.
  2080.  
  2081.                if (cache.CC[fh] is undefined)  then
  2082.                      Set cache.CC[fh] = CCrecv.
  2083.        }
  2084.    }
  2085.  
  2086.  
  2087.    Receive non-SYN segment in (state >= ESTABLISHED) => {
  2088.  
  2089.        if (Segment contains CC option  AND  RST bit is off) {
  2090.                if (SEG.CC != CCrecv)  then
  2091.                      <Segment is unacceptable; drop it and send an
  2092.                        ACK segment, as in normal TCP processing>.
  2093.        }
  2094.    }
  2095.  
  2096.  
  2097. Security Considerations
  2098.  
  2099.    Security issues are not discussed in this memo.
  2100.  
  2101. Author's Address
  2102.  
  2103.    Bob Braden
  2104.    University of Southern California
  2105.    Information Sciences Institute
  2106.    4676 Admiralty Way
  2107.    Marina del Rey, CA 90292
  2108.  
  2109.    Phone: (310) 822-1511
  2110.    EMail: Braden@ISI.EDU
  2111.  
  2112.  
  2113.  
  2114.  
  2115.  
  2116.  
  2117.  
  2118.  
  2119.  
  2120.  
  2121.  
  2122.  
  2123.  
  2124.  
  2125.  
  2126.  
  2127.  
  2128.  
  2129.  
  2130. Braden                                                         [Page 38]
  2131.  
  2132.