Debian Codegraph @

rfc1644.html

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