[フレーム]
BT

InfoQ Software Architects' Newsletter

A monthly overview of things you need to know as an architect or aspiring architect.

View an example

We protect your privacy.

Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ

Unlock the full InfoQ experience

Unlock the full InfoQ experience by logging in! Stay updated with your favorite authors and topics, engage with content, and download exclusive resources.

Log In
or

Don't have an InfoQ account?

Register
  • Stay updated on topics and peers that matter to youReceive instant alerts on the latest insights and trends.
  • Quickly access free resources for continuous learningMinibooks, videos with transcripts, and training materials.
  • Save articles and read at anytimeBookmark articles to read whenever youre ready.

Topics

Choose your language

InfoQ Homepage News Rust Rewrite Enables Cloudflare to Boost CDN Performance and Enhance Security

Rust Rewrite Enables Cloudflare to Boost CDN Performance and Enhance Security

Oct 28, 2025 2 min read

Write for InfoQ

Feed your curiosity. Help 550k+ global
senior developers
each month stay ahead.
Get in touch
Listen to this article - 0:00
Audio ready to play
0:00
0:00

By adopting Rust for one of its core subsystems, Cloudflare successfully reduced response time by 10 ms and increased performance by 25%. Additionally, the company emphasized that Rust made their system more secure and reduced development time.

On the heels of its successful migration to Rust for the Pingora subsystem, Cloudflare's engineers have rewritten from scratch one of the company's oldest and most critical components, FL, the "brain of Cloudflare":

FL is the brain of Cloudflare. Once a request reaches FL, we then run the various security and performance features in our network. It applies each customer’s unique configuration and settings, from enforcing WAF rules and DDoS protection to routing traffic to the Developer Platform and R2 [Cloudflare's object store, EN].

Cloudflare's architects decided to base FL2 on Oxy, their own internal framework for building proxies, which also includes support for monitoring, soft reloads, and dynamic configuration loading and swapping.

In particular, Oxy's built-in mechanism for graceful restarts is a critical feature for a proxy, since terminating a process would otherwise break all active connections. To prevent this, when an Oxy instance needs to be terminated, it stops accepting new connections but continues serving existing ones until they end naturally.

One critical hurdle for Cloudflare's architects was how to replace a running system that had underpinned 15 years of Cloudflare products and was still evolving. To prevent their teams from having to implement each new feature twice, once for the LuaJIT-based FL and once for the new Rust-based FL2, they created a layer inside of FL that allowed new modules implemented in Rust for FL2 to run seamlessly.

Instead of maintaining a parallel implementation, teams could implement their logic in Rust, and replace their old Lua logic with that, without waiting for the full replacement of the old system.

To properly handle such a migration, Cloudflare's architects also defined a clear testing and rollout strategy. For testing, they used Flamingo, a system capable of running thousands of full end-to-end test requests concurrently against both FL1 and FL2. Each change is rolled out gradually, and at each stage, it is fully tested against increasing traffic and benchmarked to ensure that performance and resource usage remain acceptable.

Another key mechanism was FL2's ability to pass any request it could not handle to FL1. This fallback mechanism was essential for gradually increasing FL2 usage without compromising the overall stability of Cloudflare services. During the rollout, as FL2 matured, it handled a growing proportion of traffic, while the amount of traffic falling back to FL1 decreased correspondingly.

The main advantage of building FL2, say Cloudflare architects, is the performance gain it delivers. This can be attributed to two primary factors: the fact that FL2 was entirely written in a high-performance language like Rust, rather than using a combination of C, Rust, and Lua code. Additionally, FL1 had to spend quite some time converting data representation from one language to another. As a result, FL2 requires only half the CPU of FL1 and less than half the memory.

As a final note, FL2 also benefits from Rust's compile-time security guarantees, reinforced by strong linting and checking rules, as well as strict coding standards, thorough testing, and rigorous review processes. This has led to a significant reduction in crashes, with most of these being attributed to hardware failures.

About the Author

Sergio De Simone

Show moreShow less

Rate this Article

Adoption
Style

This content is in the Security topic

Related Topics:

Related Content

The InfoQ Newsletter

A round-up of last week’s content on InfoQ sent out every Tuesday. Join a community of over 250,000 senior developers. View an example

We protect your privacy.

BT

AltStyle によって変換されたページ (->オリジナル) /