Urgent.News

What's breaking now, across hundreds of outlets.

Tech

TCP BBR vs CUBIC: Two Theories of How Fast to Send

Every TCP connection has to decide how fast to send without drowning the network. For decades the standard answer was to speed up until packets were lost, then slow down. A newer family of algorithms asks a different question: measure the path's real capacity and delay, and send at that rate before loss occurs. Both fill the same pipe, but they interpret the evidence in radically different ways.…

TCP connections must determine the optimal sending speed to prevent network congestion. Historically, the conventional method was to gradually increase the speed until packet loss occurred, then reduce it. However, a newer set of algorithms approaches the issue differently: they measure the actual capacity and delay of the path and send data at that rate before any loss occurs.

CUBIC and BBR are two such algorithms that interpret evidence in markedly different ways. CUBIC infers congestion from packet loss and reacts after the fact, while BBR models bandwidth and round-trip delay to send proactively, making it a measurement-driven protocol rather than a loss-driven one.

CUBIC is the default algorithm in most Linux systems and is derived from a lineage of loss-based congestion controls. Its foundational assumption is that a dropped packet signifies a full network. It begins with a modest sending rate, which rapidly accelerates following a slow start phase. Upon encountering a loss, it backs off and follows a cubic curve to adjust its rate.

This curve's shape is designed to swiftly recover on high-speed, high-delay paths where older algorithms were slow to adapt. Conversely, BBR, developed by Google, rejects the notion that loss is the primary indicator. Instead, it routinely measures the maximum bandwidth it can achieve and the minimum round-trip time, then sends data at the approximate product of these values—essentially, the volume of data that can fit in the pipe.

When the path is not fully utilized, increasing the data volume enhances throughput without raising delay. Conversely, if the path is saturated, delay increases. BBR observes this increase and reduces its output before loss materializes, subsequently periodically probes to ascertain if capacity has expanded. In essence, CUBIC perceives the network as a vessel prone to overflow, while BBR views it as a pipe with a quantifiable width.

When comparing the two algorithms, consider a high-bandwidth, long-delay link such as a transcontinental connection where the round-trip time is approximately 100 milliseconds. To fill such a link, a sender must maintain a substantial amount of data in transit. Loss-based algorithms increment the window size until a buffer overflows, meaning the path's buffers are regularly full, resulting in high queuing delay.

A packet that should traverse the connection in 100 milliseconds might instead wait another 100 milliseconds in a swollen queue. This delay can adversely affect video calls, causing noticeable lag even in the absence of packet loss. BBR, on the other hand, strives to maintain a nearly empty queue by transmitting at the measured pipe size.

Consequently, on the same high-bandwidth, long-delay path, BBR can deliver comparable throughput with significantly reduced steady-state delay, as it ceases to add data once delay begins to rise rather than waiting for a loss event. In networks characterized by sporadic loss, such as wireless connections, BBR also demonstrates superior performance because it does not curtail its rate when a packet experiences corruption instead of queuing.

The implications of these algorithmic differences are substantial. Global internet traffic is quantified in exabytes per month, and content delivery networks, valued at tens of billions of dollars, are contingent upon their efficiency in filling long-distance links. Even a marginal improvement in link utilization across the backbone can result in meaningful cost savings due to the recurring nature of bandwidth expenses.

BBR excels on high-bandwidth, high-delay, or lossy paths where minimized queuing is paramount, whereas CUBIC maintains competitiveness and exceptional fairness on conventional networks where loss reliably indicates congestion. Consequently, the choice between these algorithms is dictated by specific path characteristics rather than being universally applied.

However, both algorithms have inherent limitations. BBR's drawback lies in its fairness and handling of shallow buffers. Since it maintains transmission near the measured capacity, multiple BBR flows sharing a bottleneck may overexert themselves simultaneously, sometimes unfairly competing with loss-based flows. Additionally, sudden changes in path delay unrelated to its traffic, such as routing alterations or competing bursts, can adversely affect BBR's performance.

Earlier versions of BBR were criticized for their aggressive behavior; subsequent updates incorporated mitigations, but these adjustments demand careful tuning.

In contrast, CUBIC's primary weakness is its tolerance for excessive queuing, particularly on paths with large buffers. It may completely fill these buffers before recognizing congestion, leading to high and variable latency—a phenomenon known as bufferbloat. Furthermore, CUBIC can misinterpret non-congestion loss as congestion, thereby throttling itself on noisy wireless links even when the underlying infrastructure remains unaffected.

On extremely high-speed paths, the time required to rediscover capacity after each loss event can waste a segment of available bandwidth. Neither algorithm is theoretically perfect; each encapsulates a particular theory regarding the nature of a network, and the efficacy of each theory depends on the specific characteristics of the network in question.

Ultimately, the debate between CUBIC and BBR underscores the complexity of congestion control, highlighting that a network cannot be directly observed. Thus, decisions about network behavior must be inferred from signals. Loss represents a delayed, ambiguous signal, whereas delay is an earlier, noisier indicator. The selection between these approaches involves weighing the types of errors one is willing to accept.

Rewritten by urgent.news; may contain errors — check the original.

Source: dev.to

Read the original at dev.to →

Report a problem with this story

More in Tech

Zero-Knowledge Rollups vs Optimistic Rollups: Two Ways to Trust a Chain

A blockchain that processes everything on the main chain is slow and expensive. Rollups move the work off-chain and post only a compact result back, but they disagree about how that result should be…

  • Zero-knowledge rollups use cryptographic proofs for transaction validation
  • Optimistic rollups rely on challenges and observer honesty for validation
  • Both methods achieve similar security but differ in trust mechanisms

Vectorized Execution vs JIT Compilation: Two Ways to Make Queries Fast

Modern query engines face the same enemy: the cost of interpreting a query plan value by value. Two schools emerged to fight it. One processes many values at a time in tight loops over arrays.

  • Vectorized execution processes many values at once through array or batch operations.
  • JIT compilation compiles query plans into machine code to eliminate interpretation.
  • Hybrid engines combine both methods for tailored query performance.

More from Thursday 26 November →