Brifing

How Cloudflare Cut Data Pipeline Bandwidth to Counter Exponential Growth

Architectural shifts deferred years of hardware expansions across globally distributed systems.

Cloudflare Blog4 min

1Exponential Growth Versus Hardware

Cloudflare manages over 20% of web traffic, delivering roughly two billion events per second across global networks. Handling this massive scale requires counteracting exponential data growth against linear hardware capacity. System redesigns over five years deferred two and a half years of hardware expansion while serving core analytical products.

2Breaking Monolithic Schema Bottlenecks

In 2022, engineers dismantled a monolithic schema that previously bundled HTTP, Security, and CDN metadata into a single stream. Product-specific schemas replaced the universal firehose, eliminating unwanted fields for consumers. Despite duplicating specific identifiers, this granular restructuring reduced backbone transit bandwidth by 35% to 40% across the global infrastructure.

3Modernizing Transit Stream Compression

By 2024, persistent network congestion prompted a migration from LZ4 to zstd compression. Initial testing verified that CPU overhead remained negligible during fleet-wide deployment. This transition delivered nearly a 40% reduction in compressed traffic throughput, allowing the same physical pipeline capacity to absorb 1.5 times more uncompressed incoming event traffic.

4Eliminating Costly Transit Double-Writing

Disaster recovery historically required the edge agent, Logfwdr, to transmit duplicate event copies across wide-area networks to separate regional centers. As regional disaster coverage expanded, this double-writing model saturated transit links. Decoupling network transit from database redundancy allowed single-copy edge routing before replicating downstream within dedicated buffering systems.

5Late Stage Replication Architecture

The modernized pipeline dispatches events once to a shared receiver pool, buffering raw streams into Buftee. Cross-datacenter replication occurs downstream after regional sampling reduces data volume. Uniformly batched data partitions in central hubs compress far better than edge fragments, cutting transit volume by 43 GB/s while adding only 7 GB/s replication.

6Decentralizing Edge Sampling Logic

Sampling initially executed only at centralized receiver nodes before reaching ClickHouse. Engineers introduced square-root sampling directly inside edge Logfwdr instances alongside central filters. Records are grouped by designated indexing keys, shuffled to eliminate bias, and sampled at a rate proportional to the square root of total partition record counts.

7Power Law Storage Attenuation

Applying double sampling attenuates storage growth for high-frequency keys while preserving raw fidelity for low-frequency occurrences. A high-volume key with 100 times more data stores roughly four times the rows instead of ten. Across three top datasets, this mathematical reduction removed 25 GB/s of compressed transit volume, exceeding 2 PB daily.

8Multi-Stage Distributed Pipeline Aggregation

Certain analytics streams rely on exact metric rollups rather than probabilistic sampling. Instead of computing aggregates inside final ClickHouse inserters, calculations occur across every pipeline stage. Partial aggregates combine within Logfwdr, merge again at centralized receivers, consolidate inside partitioned buffers, and finish through ClickHouse aggregating table engines.

9Shrinking High Cardinality HTTP Streams

Deploying distributed aggregation on high-cardinality HTTP analytics reduced compressed wire traffic from over 9 GB/s down to 2 GB/s. This 80% wire reduction proved that computing incremental sums and unique counts early eliminates transit waste. The success motivated standardizing internal tooling through a dedicated service called Ready-Aggregates.

10Absorbing Rapid Traffic Headroom Rebound

Production metrics from Ready-Analytics illustrate the velocity of organic traffic expansion. In mid-May, load balancing halved throughput from 26 GB/s to 13 GB/s, yet volume surged back to 20 GB/s within two months. Subsequent edge sampling dropped volume to single digits, preventing projected overruns beyond 60 GB/s by September.

11Quantifying Centralized Compute Savings

Decentralizing data processing away from core facilities yielded substantial compute and memory recoveries. Within Ready-Analytics receivers alone, combined load balancing and sampling reduced resource consumption by 50%, freeing 750 CPUs and 3.5 TiB of RAM. Pipeline modifications combined to eliminate approximately 70 GB/s of compressed backbone network transit.

12Sustainable Engineering At Scale

Scaling global data architectures demands shifting computation toward distributed collection points rather than endlessly adding central hardware. Decoupling replication, applying early mathematical sampling, and aggregating at ingestion allow infrastructure to outpace exponential traffic. Continuous pipeline efficiency guarantees operational resilience without relying on matching linear server expansions.

Original article: Cloudflare Blog — How Cloudflare Cut Data Pipeline Bandwidth to Counter Exponential Growth