TCP/IP Study Notes (13)-TCP persistence timer and TCP retention Timer

Source: Internet
Author: User

TCP has a total of four main timers. As mentioned above, a timeout timer is the most complex one in TCP, and the other three are:

  1. Stick to Timer
  2. Active Timer
  3. 2msl Timer

The persistence timer is used to prevent the two sides from waiting for deadlocks after the announcement window is 0, while the persistence timer is used to process semi-open connections.

1. Stick to the timer

It is simple to stick to the timer principle. When the TCP server receives the client's 0 sliding window message, it starts a timer to time the message, when the timer overflows, check whether the window has increased to the client. If a non-zero window is obtained, send data again, if the window is 0, a new timer is created to prepare for the next query. We can see through observation that the TCP persistence timer uses 1, 2, 4, 8, 16 ...... The ordinary Exponential Backoff sequence such as 64 seconds serves as the overflow time for each time.

Confused window syndrome

The TCP Window Protocol causes a problem that is usually called confused window syndrome. The specific manifestation is that when the client advertises a small non-zero window, the server immediately sends small data to the client and is filled with its buffer. Once used, the network will be filled with small TCP datagram, thus affecting network utilization. This obfuscation of the sender and acceptor. TCP provides some suggestions (or rules ).

  1. The recipient does not notice a small window. The common algorithm is that the receiver does not advertise a window larger than the current window (which can be 0 ),
    Unless the window can increase the size of a message segment (that is, the MSS to be received) or increase the buffer space of the receiver.
    No matter the actual number.
  2. The sender can avoid confusion window syndrome by sending data only when one of the following conditions is met: (a) Yes
    To send a full-length packet segment. (B) You can send a packet segment that is at least half the size of the receiver's announcement window. (c) You can
    Send any data and do not want to receive ack (that is, we have no unconfirmed data) or the connection
    You cannot use the Nagle algorithm.

Okay. Now let's recall that many TCP regulations are designed to send as much data as possible during a single transmission, such as the routing rule with Ack data packets and the Nagle algorithm, the policy for sending original data packets during re-transmission, and so on.

2. Active Timer

It is easier to keep the timer. Do you still remember that FTP or HTTP servers have the sesstion time mechanism? Because TCP is connection-oriented, there will be a "semi-open connection" that only connects and does not transmit data. The server must detect this connection and release this connection in some cases, this is the role of the active timer. The time limit varies with the server implementation. In addition, if one end crashes and restarts, if it receives the "active" detection from this end, send an rst data packet to help the other end the connection.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.