Skip to content

Lab

The path of one request

A program sends one request to a pod behind a Service. Then a fault starts on the path: a A fault that drops each packet without an answer. The peer seems to be there, but nothing comes back., a The process of the peer stops, for example in a long pause of its event loop. Its kernel still answers each packet. or a The network between two nodes breaks for a time, then it heals.. Five layers can find the fault, and each one has its own timers. This page computes, in your browser, when each layer knows.

Who knows first?
The fault
The request

The program knows first, at 10 s. TCP would know at 15 min 25 s to 18 min 4 s.

A call with a deadline of 10 s and 2 retries, on the defaults of Linux and Kubernetes.

The black hole starts at 0 s0 s200 ms1 s5 s20 s60 s5 min20 minProgramThe program: 10 sknows 10 sThe program sends the request: 0 sDeadline of try 1: 10 sRetry 1: 10.2 sDeadline of try 2: 20.2 sRetry 2: 20.6 sDeadline of try 3: 30.6 sSocketThe socket: 15 min 25 s to 18 min 4 sknows 15 min 25 sThe next read returns ETIMEDOUT: 15 min 25 sTCPTCP: 15 min 25 s to 18 min 4 sknows 15 min 25 sTail loss probe: 201 msRetransmission 1: 402 msRetransmission 2: 804 msRetransmission 3: 1.608 sRetransmission 4: 3.216 sRetransmission 5: 6.432 sRetransmission 6: 12.864 sRetransmission 7: 25.728 sRetransmission 8: 51.456 sRetransmission 9: 102.912 sRetransmission 10: 3 min 26 sRetransmission 11: 5 min 26 sRetransmission 12: 7 min 26 sRetransmission 13: 9 min 26 sRetransmission 14: 11 min 26 sRetransmission 15: 13 min 26 sthe retransmission give-up: ETIMEDOUT: 15 min 25 sKubernetescannot see the faultNICcannot see the faultSends: tail loss probe: 201 msSends: retransmission 1: 402 msSends: retransmission 2: 804 msSends: retransmission 3: 1.608 sSends: retransmission 4: 3.216 sSends: retransmission 5: 6.432 sSends: retransmission 6: 12.864 sSends: retransmission 7: 25.728 sSends: retransmission 8: 51.456 sSends: retransmission 9: 102.912 sSends: retransmission 10: 3 min 26 sSends: retransmission 11: 5 min 26 sSends: retransmission 12: 7 min 26 sSends: retransmission 13: 9 min 26 sSends: retransmission 14: 11 min 26 sSends: retransmission 15: 13 min 26 s
  • the fault
  • the layer knows, in this band
  • recovers
  • a send again or a timer
  • a probe
  • measured median of a cell

The axis is logarithmic, thus the first second and the last hour both fit.

  1. The program

    First · Knows at 10 s

    The deadline finds the fault at 10 s. 2 retries also wait, and the call fails at 30.6 s.

    Deadline
    10 s
    Tries
    3
    The call gives up at
    30.6 s
    The time that a program waits for one reply before it stops the call. 10 s
  2. The socketThe handle of a program on one TCP connection. The program writes to it and reads from it.

    Knows at 15 min 25 s to 18 min 4 s

    The socket shows nothing until TCP gives up. At 15 min 25 s to 18 min 4 s, the next read or write returns ETIMEDOUT.

    The write
    returns at once
    Send queue
    the request, until an ACK
  3. TCPRetransmission timeout. TCP sends a segment again if no ACK comes in this time. Each new try waits two times longer.

    Knows at 15 min 25 s to 18 min 4 s

    The retransmission give-up finds the fault at 15 min 25 s to 18 min 4 s, and the socket gets ETIMEDOUT.

    First RTO
    201 ms
    Retransmissions
    15
    Delayed ACK, at most
    40 ms
    keepalive
    held: tx.retransmit.first cancels it
    The socket option that turns on keepalive. It is off on a socket by default.
    A socket option: the longest time that sent data can stay without an ACK. 0 turns it off. off
    The clock of the kernel: the ticks in each second. A timer fires on a tick, thus it can be late by one tick or more.
  4. KubernetesThe program on each node that writes the rules that send the traffic of a Service to its pods.

    Cannot see it

    The kubelet probes the pod from its own node, and the black hole is on the path between the nodes. Each probe passes, and the pod stays in the Service.

    Propagation, iptables
    27 ms to 92 ms (measured)
    conntrack keeps this flow
    while packets pass
    The program on each node that writes the rules that send the traffic of a Service to its pods.
  5. The NICNetwork interface card: the hardware that puts the packets on the wire.

    Cannot see it

    The NIC sends each segment, 16 after the request. The loss is past its wire, thus its link stays up and its counters show no error.

    A full queue drains in
    1.2 ms
    Segments it sends after the request
    16
    Link rate
    Maximum transmission unit: the largest packet on the link, in bytes.
  • The headline tells which layer knows first, and when.
  • The timeline has one lane for each layer, in the sequence of the path. Press Play to see the story. A layer lights when it finds the fault.
  • The cards below the timeline give each layer, with its knobs. Change a knob, and each time on the page changes.
  • An orange dot is the median that a cell of the harness or of kind measured. It shows only when your settings are the settings of that cell. Its link opens the cell.

Each time comes from the algebra of this repository, @mark1russell7/algebra. The algebra operates on four machine documents of @mark1russell7/machines. Two are the TCP stack of Linux 6.6 and its The table of the kernel that remembers each connection through a NAT, for example the address of the pod behind a Service. table. One is the call of the program, with a The time that a program waits for one reply before it stops the call. and its retries. The last is the The kubelet asks the pod a question each period. After a number of failures in a row, the pod leaves the Service. of the The agent of Kubernetes on each node. It starts the pods and probes them. of Kubernetes 1.37.0.

A probe that takes longer than its period starts the next probe at once, because the kubelet probes in sequence. Thus the probes come at intervals of the longer of the period and the timeout.

Each amount prints through format of @mark1russell7/quantity. The page does no timer arithmetic of its own.

  • The program knows only what its own deadline tells it. Without a deadline, it waits for a layer below.
  • The socket has no timer. A write goes into the The memory of the kernel that keeps the data that the peer did not acknowledge. at once. The error of TCP comes at the next read or write.
  • TCP sends again on each Retransmission timeout. TCP sends a segment again if no ACK comes in this time. Each new try waits two times longer., and it stops after A sysctl: the number of RTO retransmissions before TCP stops the connection. The default is 15, approximately 15 min. retransmissions. On an idle connection, only Probes that TCP sends on an idle connection. If no probe gets an answer, TCP stops the connection. can find the fault.
  • Kubernetes probes the pod from its own node. A probe finds a stalled pod, but it does not find a black hole between two nodes. After the pod leaves the Service, The program on each node that writes the rules that send the traffic of a Service to its pods. changes the rules of each node. New connections go to other pods. A connection that is open stays on the old pod, because conntrack keeps its Network address translation. The node rewrites the address of the Service to the address of one pod..
  • The NIC sends each segment and sees no error. The loss is past its wire.

The propagation of a change to the rules of each node has no closed form. The page adds the band that the kind cells measured for each mode. Cilium has no measured band, thus the page shows only the time of the kubelet for Cilium.

The page assumes one round trip. A cell assumes a range of round trips. Thus a band of a cell can differ from the band of the page by a few milliseconds.