Quick Takeaways
What you'll learn in this article
- 1
Explore the rise of Rust in system programming and how it is revolutionizing performance and safety in tech giants
Keep reading for detailed implementation, code examples, and real-world results
Why Tech Giants are Embracing Rust: Inside the Decision-Making at Microsoft, Google, Meta, Amazon, and Beyond
A quiet revolution has been unfolding inside the world's largest technology companies. One by one, organizations responsible for the software infrastructure that underpins modern life have arrived at the same conclusion: the status quo of systems programming is no longer acceptable. Decades of memory safety vulnerabilities, unpredictable latency from garbage collection, and the sheer maintenance burden of massive C and C++ codebases have pushed engineering leadership to seek a fundamentally different approach. That approach, for an increasing number of these companies, is Rust.
This is not a story about language popularity contests or developer sentiment surveys. It is a story about engineering organizations with billions of users making deliberate, measured decisions to adopt a new systems programming language for their most critical infrastructure. Each company arrived at Rust through its own path, facing its own constraints, and measuring success by its own metrics. But the convergence is unmistakable. Microsoft is rewriting Windows kernel components in Rust. Google has embedded Rust into Android, Chromium, and its experimental Fuchsia operating system. Meta rebuilt its entire build system in Rust. Amazon built its serverless virtualization layer from scratch in the language. Cloudflare replaced Nginx with a Rust-based proxy. Discord eliminated latency spikes by rewriting core services. And the Linux kernel itself now accepts Rust modules alongside C.
This article examines the detailed case studies behind these adoptions. For each company, we explore the specific problems that motivated the decision, the technical strategies employed during migration, the measured results achieved in production, and the organizational lessons learned along the way. The goal is not to evangelize Rust but to provide the depth and specificity that engineering leaders need to understand what adoption actually looks like at scale.
Memory Safety CVE Share
~70%
Percentage of security vulnerabilities caused by memory safety bugs at major tech companies over the past decade
The Common Thread: Why Memory Safety Became Non-Negotiable
Before examining individual case studies, it is worth understanding the shared catalyst that drove so many companies toward Rust in roughly the same timeframe. The answer is memory safety, and specifically the recognition that memory safety bugs represent a systemic rather than incidental problem in systems software.
Microsoft's security team published data showing that approximately 70 percent of the security vulnerabilities they patched each year were caused by memory safety issues: buffer overflows, use-after-free bugs, null pointer dereferences, and data races. Google's Project Zero team found nearly identical numbers in Chromium. The United States National Security Agency issued formal guidance in November 2022 recommending that organizations transition to memory-safe programming languages. The Cybersecurity and Infrastructure Security Agency (CISA) followed with similar recommendations.
These were not theoretical concerns. Heartbleed, a buffer over-read in OpenSSL's C implementation, affected an estimated 17 percent of the internet's secure web servers when it was disclosed in 2014. WannaCry, which exploited a buffer overflow in Windows' SMB implementation, caused an estimated 4 billion dollars in damages globally. Every year, memory safety bugs in systems software led to data breaches, service outages, and security incidents affecting billions of users.
The traditional response was better tooling, more code review, and additional testing. But decades of effort had proven that these approaches could reduce the rate of memory safety bugs without eliminating them. Even the most disciplined engineering teams, working with the best static analysis tools, continued to ship memory safety vulnerabilities in C and C++ code. The fundamental issue was that these languages place the full burden of memory management on the developer, and human beings make mistakes, especially across large codebases maintained by many engineers over many years.
Rust offered a structural solution. Its ownership and borrowing system moves memory safety verification to compile time. The borrow checker statically ensures that references are always valid, that data cannot be simultaneously mutated from multiple locations, and that resources are freed exactly once. This eliminates entire categories of bugs before the code ever runs, without the runtime overhead of garbage collection. For companies spending hundreds of millions of dollars annually on security patching and incident response, the value proposition was clear.
| Name | Value |
|---|---|
| Memory Safety Bugs | 70 |
| Logic Errors | 15 |
| Configuration Issues | 8 |
| Other Vulnerabilities | 7 |
Microsoft: From Windows Kernel to Azure Infrastructure
Microsoft's Rust journey is particularly significant because the company is arguably the world's largest C and C++ shop. Windows, Office, SQL Server, and Azure are built on hundreds of millions of lines of C and C++. Adopting Rust at Microsoft meant confronting not just technical challenges but deeply entrenched organizational culture, toolchains, and development practices.
The Security Imperative
Microsoft's Rust exploration began in earnest around 2019, driven by the Microsoft Security Response Center (MSRC). The MSRC had been tracking the root causes of security vulnerabilities across Microsoft products for years, and the data was unambiguous. In presentation after presentation, MSRC engineers showed that roughly 70 percent of the CVEs they assigned each year were memory safety issues. Despite massive investments in static analysis tools like SAL annotations, AddressSanitizer integration, and fuzzing infrastructure, the rate of memory safety bugs was not declining. New code written in C and C++ continued to introduce these vulnerabilities at a roughly constant rate.
The MSRC began exploring alternatives. They evaluated several memory-safe languages including Go, Swift, and Rust. Go was rejected for kernel and low-level systems work because its garbage collector introduced unpredictable latency and its runtime was too heavyweight for OS-level code. Swift was considered but its ecosystem was too tightly coupled to Apple's platforms. Rust emerged as the clear frontrunner because it offered memory safety without a garbage collector, had zero-cost abstractions that compiled to efficient machine code, and could interoperate with existing C and C++ code through well-defined FFI boundaries.
Windows Kernel Integration
In 2023, Microsoft announced that Rust code had been integrated into the Windows kernel, beginning with the DWriteCore text rendering library. This was a landmark moment. The Windows kernel is one of the most security-sensitive codebases in the world, running on over a billion devices. Introducing a new language into this environment required solving numerous technical and organizational challenges.
The technical challenges centered on FFI (Foreign Function Interface) interoperability. The Windows kernel has a vast API surface defined in C, and Rust code needed to call into existing kernel APIs while also being callable from C code. Microsoft developed custom tooling to generate Rust bindings for Windows kernel APIs, building on the windows-rs crate that provides safe Rust wrappers for the broader Windows API surface.
Memory allocation in the kernel presented another challenge. The Windows kernel uses pool allocators with specific tagging requirements for memory tracking and debugging. Rust's default allocator could not be used. Microsoft implemented custom allocators in Rust that integrated with the kernel's existing memory management infrastructure, allowing Rust code to participate in the same memory tracking and debugging workflows that C code used.
The organizational challenges were equally significant. Thousands of Windows kernel developers had decades of collective experience in C and C++. Introducing Rust meant training developers in a new language, updating code review processes, modifying build systems, and establishing coding standards. Microsoft took an incremental approach, beginning with new components rather than rewriting existing ones. This allowed the organization to build Rust expertise gradually while delivering immediate security benefits in new code.
Azure and Cloud Infrastructure
Beyond the kernel, Microsoft adopted Rust for security-critical Azure infrastructure. Azure IoT Edge, the runtime that manages IoT devices connected to Azure cloud services, incorporated Rust components for its security daemon. The security daemon handles device provisioning, certificate management, and communication with Azure cloud services, making it a high-value target for attackers and an ideal candidate for memory-safe implementation.
Microsoft also invested in Rust for components of Azure's networking infrastructure. Network data plane code processes untrusted packets at extremely high rates, and any vulnerability in this layer could compromise the isolation between Azure tenants. Rust's memory safety guarantees provided a structural defense that complemented the existing defense-in-depth strategies.
Mark Russinovich, Azure's CTO, publicly stated that new systems-level projects at Microsoft should use Rust rather than C or C++, calling it "the industry's best chance at addressing" the memory safety problem. While this was a directional statement rather than a mandate, it reflected a genuine shift in how Microsoft's engineering leadership thought about language choice for systems software.
MSRC Publishes Memory Safety Data
Microsoft Security Response Center reveals that 70% of CVEs are memory safety bugs, catalyzing exploration of alternatives to C/C++.
Rust Evaluation Begins
Internal teams evaluate Rust against Go, Swift, and other candidates for systems programming use cases.
Azure IoT Edge Adoption
Azure IoT Edge security daemon incorporates Rust components for device provisioning and certificate management.
Windows-rs Crate Matures
Microsoft's windows-rs crate provides comprehensive safe Rust bindings for Windows APIs, enabling broader adoption.
Rust Enters the Windows Kernel
DWriteCore becomes the first Rust component shipped in the Windows kernel, running on over a billion devices.
Expanded Kernel Integration
Additional Windows kernel components written in Rust enter production, with custom allocators and kernel API bindings.
Lessons Learned at Microsoft
Microsoft's Rust adoption revealed several key organizational insights. First, incremental adoption was essential. Attempting to rewrite existing C/C++ codebases would have been prohibitively expensive and risky. Instead, writing new components in Rust while maintaining existing code in its original language allowed Microsoft to capture security benefits immediately without the risk of large-scale rewrites.
Second, toolchain integration mattered enormously. Rust needed to work within Microsoft's existing build systems, debugging tools, and CI/CD pipelines. Significant engineering effort went into making Rust a first-class citizen in Microsoft's development infrastructure rather than a separate ecosystem that developers had to context-switch into.
Third, developer training required patience. The borrow checker, while providing enormous safety benefits, represented a genuinely different mental model for developers accustomed to C and C++. Microsoft found that experienced systems programmers typically needed three to six months to become productive in Rust, with the steepest part of the learning curve occurring in the first few weeks as developers internalized ownership and lifetime concepts.
Google: Android, Chromium, and Fuchsia
Google's Rust adoption spans three of the company's most important software projects: Android, Chromium, and Fuchsia. Each project adopted Rust for related but distinct reasons, and examining them together reveals how a single organization can apply Rust across very different technical contexts.
Android: Rewriting the Platform Layer
In April 2021, Google announced that Rust was now a supported language for the Android Open Source Project (AOSP). This was a consequential decision. Android runs on over three billion active devices, and the platform's native code layer, which includes networking stacks, media codecs, Bluetooth drivers, and kernel components, had been a persistent source of security vulnerabilities.
Google's Android security team published data showing that memory safety bugs accounted for approximately 65 percent of high and critical severity vulnerabilities in Android's native code. The team also observed a pattern: most memory safety bugs appeared in new or recently modified code rather than in mature, well-tested code. This insight had profound implications for the migration strategy. Rather than rewriting existing stable code, Google focused on writing all new native code in Rust while leaving existing C and C++ code in place.
The results were remarkable. Between 2019 and 2024, the percentage of memory safety vulnerabilities in Android dropped from roughly 76 percent to approximately 24 percent, even as the total amount of new code continued to grow. This decline occurred because new Rust code was not introducing memory safety bugs at the rate that new C/C++ code historically had, and the existing C/C++ code was becoming more stable through ongoing testing and hardening. The absolute number of memory safety vulnerabilities decreased year over year despite the overall codebase growing.
Google invested heavily in Rust-C++ interoperability tooling for Android. The cxx crate and custom bindings generators allowed Rust code to call into existing C++ Android framework APIs and vice versa. This interoperability was crucial because Android's native layer could not be rewritten overnight. New Rust components needed to seamlessly integrate with existing C++ components, sharing data structures, handling errors across language boundaries, and participating in Android's existing logging, tracing, and debugging infrastructure.
Chromium: Security at Browser Scale
Google's Chromium team began exploring Rust integration around the same time as Android. Chromium's security challenges are similar to Android's but amplified by the browser's role as the primary interface between users and untrusted web content. Every URL loaded, every JavaScript file executed, and every image rendered represents potential attack surface. Chromium's C++ codebase had been a frequent target for security researchers, and memory safety bugs in the browser engine were among the highest-value vulnerabilities in the entire software industry.
The Chromium team adopted a careful, methodical approach to Rust integration. They established a policy that Rust code in Chromium must be used for new, self-contained components rather than being interleaved with existing C++ code in complex ways. This constraint simplified the interoperability challenge and reduced the risk of introducing subtle bugs at language boundaries. Rust was used for new parsing logic, data format handling, and security-sensitive utilities where the benefits of memory safety were most pronounced.
The Chromium team also contributed to the broader Rust ecosystem by improving tools for C++/Rust interoperability, developing best practices for mixed-language codebases, and sharing their experience with other large organizations considering similar migrations.
Fuchsia: A Rust-First Operating System
Fuchsia, Google's experimental capability-based operating system, represents the most aggressive Rust adoption within Google. Unlike Android and Chromium, where Rust was integrated into existing C/C++ codebases, significant portions of Fuchsia were written in Rust from the beginning.
Fuchsia's architecture is built around a microkernel (Zircon, written in C++) with user-space services communicating through FIDL (Fuchsia Interface Definition Language). Many of these user-space services, including networking components, file systems, and device drivers, were implemented in Rust. The FIDL bindings for Rust were developed alongside the C++ bindings, ensuring that Rust services could participate fully in Fuchsia's inter-process communication framework.
The Fuchsia project served as a proving ground for Rust in operating system development. It demonstrated that Rust could be used effectively for OS-level code including device drivers, filesystem implementations, and network stack components. The lessons learned on Fuchsia influenced Google's broader Rust strategy, informing decisions about tooling, training, and interoperability patterns that were subsequently applied to Android and Chromium.
| year | percentage |
|---|---|
| 2019 | 76 |
| 2020 | 68 |
| 2021 | 55 |
| 2022 | 43 |
| 2023 | 32 |
| 2024 | 24 |
Lessons Learned at Google
Google's experience highlighted the power of focusing Rust adoption on new code rather than rewriting existing code. The Android data showed that memory safety vulnerability rates could be dramatically reduced without undertaking expensive and risky rewrite projects. By ensuring that all new native code was written in Rust, Google achieved a natural, gradual transition that improved security year over year as the proportion of Rust code in the codebase grew.
Google also demonstrated the importance of investing in interoperability tooling. Both Android and Chromium required Rust to work seamlessly alongside large existing C++ codebases. The engineering effort invested in FFI tooling, bindings generators, and mixed-language build system support was as important as any individual Rust component.
Meta: Rebuilding Developer Infrastructure
Meta's Rust adoption followed a different path than Microsoft or Google. Rather than focusing primarily on security-sensitive system components, Meta embraced Rust for large-scale developer infrastructure, building tools that are used by tens of thousands of engineers every day.
Buck2: The Build System Rewrite
Meta's most prominent Rust project is Buck2, a complete rewrite of their Buck build system. Buck, originally written in Java, had been the foundation of Meta's build infrastructure for years, compiling and linking the enormous codebases that power Facebook, Instagram, WhatsApp, and other Meta products. As Meta's monorepo grew to contain hundreds of millions of files and the developer population expanded to tens of thousands, Buck's performance became a critical bottleneck.
The decision to rewrite Buck in Rust rather than optimizing the existing Java implementation was driven by fundamental architectural limitations. Java's garbage collector introduced unpredictable pauses during builds, particularly during the graph computation phases where Buck analyzed dependency relationships between millions of build targets. The JVM's memory overhead was also substantial, requiring beefy build machines to handle large builds.
Buck2, written entirely in Rust, eliminated these issues. Without a garbage collector, build operations had predictable, consistent performance. Rust's ownership model enabled aggressive parallelism during dependency graph computation, with the compiler ensuring that concurrent access to shared data structures was safe. Buck2 also benefited from Rust's zero-cost abstractions, using expressive high-level patterns for graph traversal and incremental computation that compiled down to highly efficient machine code.
The performance improvements were dramatic. Meta reported that Buck2 achieved build speeds roughly twice as fast as Buck for many common workflows, with significantly lower memory consumption. For a company where developer productivity directly translates to revenue capacity, this improvement had measurable business impact.
Sapling: Source Control at Scale
Meta also rewrote portions of its source control system in Rust. Meta operates one of the largest monorepos in the world, and their source control tooling, originally based on Mercurial with heavy customization, needed to handle operations across hundreds of millions of files efficiently.
Sapling, Meta's source control client, uses Rust for its core algorithms including working copy management, diff computation, and conflict resolution. These operations are performance-critical because developers interact with source control constantly throughout their workday. A slow diff command or a sluggish status check interrupts developer flow and reduces productivity across the entire engineering organization.
Rust's performance characteristics were ideal for these workloads. String processing, file system operations, and data structure manipulation all benefited from Rust's zero-cost abstractions and lack of garbage collection overhead. The memory safety guarantees also reduced the maintenance burden, as source control bugs that corrupt repository state can have far-reaching consequences.
Mononoke: Server-Side Repository Management
On the server side, Meta built Mononoke, a repository server written in Rust that replaced their previous Mercurial-based server infrastructure. Mononoke handles the storage, retrieval, and manipulation of source code for Meta's entire engineering organization. It processes hundreds of thousands of operations per second during peak development hours, serving commits, trees, and file blobs to developers and CI systems across the company.
Rust's async ecosystem, particularly the Tokio runtime, enabled Mononoke to handle massive concurrency with low resource overhead. The server could maintain thousands of simultaneous connections without the thread-per-connection overhead that would have been required in many other languages. Rust's ownership model also simplified the implementation of concurrent data structures needed for caching and request deduplication.
Meta Build System: Buck (Java) vs Buck2 (Rust)
Buck2 (Rust)
Buck (Java)
Lessons Learned at Meta
Meta's experience demonstrated that Rust's benefits extend far beyond security-critical code. The build system and source control use cases were primarily about performance, predictability, and developer productivity rather than vulnerability prevention. This broadened the case for Rust adoption by showing that the language delivers value across a wider range of use cases than the security narrative alone suggests.
Meta also validated that Rust is effective for large-scale application development, not just small, focused systems components. Buck2 and Mononoke are substantial software systems with complex business logic, and they showed that Rust's type system and error handling model scaled well to these kinds of applications.
Amazon: Securing the Serverless Foundation
Amazon Web Services has arguably invested more heavily in Rust for production infrastructure than any other organization. Their adoption story centers on the insight that the most critical pieces of cloud infrastructure, the components responsible for isolating customer workloads and securing data, demand the strongest possible safety guarantees.
Firecracker: The MicroVM Revolution
Firecracker, the virtual machine monitor that powers AWS Lambda and AWS Fargate, is perhaps the most prominent Rust project in cloud computing. AWS built Firecracker from scratch in Rust starting in 2017, and it entered production in 2018. The project was motivated by a specific technical requirement: Lambda needed a virtualization layer that could boot VMs in milliseconds, consume minimal memory per VM, and provide strong security isolation between customer workloads.
The decision to build Firecracker in Rust rather than extending QEMU (written in C) was driven by both security and performance considerations. QEMU's codebase spans millions of lines and supports dozens of hardware architectures and device models. This flexibility came at the cost of a large attack surface. For Lambda, which only needed to virtualize a specific set of hardware features, a purpose-built VMM with a minimal codebase was far more appropriate.
Firecracker's Rust implementation is approximately 50,000 lines of code. Each microVM boots in approximately 125 milliseconds and consumes about 5 megabytes of memory overhead. These numbers enabled AWS to pack thousands of microVMs onto a single physical host, fundamentally changing the economics of serverless computing. The lack of garbage collection meant that VM operations had predictable latency, critical for Lambda's billing model where customers pay for actual execution time.
The security benefits were equally important. Firecracker runs as the security boundary between customer workloads. Any vulnerability in the VMM could allow one customer to access another customer's data or escape the sandbox entirely. Rust's memory safety guarantees meant that entire classes of potential exploits, buffer overflows, use-after-free bugs, and data races, were eliminated at compile time rather than requiring ongoing discovery through fuzzing and penetration testing.
Lambda and S3: Rust Throughout the Stack
Beyond Firecracker, AWS adopted Rust for components throughout the Lambda execution environment. The Lambda runtime, which manages function invocation, input/output, and logging, includes Rust components optimized for the unique constraints of serverless execution. Cold start latency, the time between a function invocation and the start of user code execution, is a critical metric for Lambda. Rust's fast startup time and minimal runtime overhead helped AWS reduce cold start latencies.
AWS also employed Rust in S3's storage infrastructure. S3 processes trillions of requests annually and stores over 200 exabytes of data. At this scale, even small performance improvements translate to meaningful reductions in infrastructure costs. AWS used Rust for performance-critical data path components in S3, benefiting from the language's predictable performance characteristics and efficient memory usage.
Shane Miller, who led AWS's Rust adoption efforts, described the company's approach as using Rust wherever "performance, correctness, and resource efficiency" were top priorities. This encompassed not just Lambda and S3 but also networking components, container infrastructure, and internal tools.
Bottlerocket: Container-Optimized OS
AWS extended its Rust commitment to the operating system layer with Bottlerocket, a Linux-based OS designed specifically for running containers. Bottlerocket's API server, update engine, and settings management system are written in Rust. These components handle configuration requests from container orchestrators like Kubernetes, manage automated security updates, and enforce system policies.
The choice of Rust for these components reflected AWS's defense-in-depth philosophy. The API server processes input from container orchestration systems, making it a potential attack vector. The update engine manages the integrity of the operating system itself. Both required the highest possible reliability and security standards, making Rust a natural choice.
Lessons Learned at Amazon
Amazon's experience demonstrated that Rust is production-ready for the most demanding workloads in cloud computing. Firecracker processes billions of Lambda invocations, and S3 handles trillions of storage requests. These are not experimental deployments or proof-of-concept projects. They are the foundation of the world's largest cloud provider.
AWS also showed that building new systems in Rust from scratch, rather than rewriting existing systems, was the most effective adoption strategy. Firecracker did not rewrite QEMU. It was a purpose-built system designed from the beginning to take advantage of Rust's unique strengths. This clean-sheet approach avoided the complexities of incremental migration while delivering maximum benefit from the language's safety and performance characteristics.
Cloudflare: Replacing Nginx at Internet Scale
Cloudflare's Rust adoption story is defined by one of the most ambitious infrastructure replacements in recent memory: the development of Pingora, a Rust-based HTTP proxy framework that replaced Nginx as the foundation of Cloudflare's edge network.
The Decision to Replace Nginx
Cloudflare's edge network handles a significant percentage of all HTTP traffic on the internet. For years, this traffic was processed by Nginx, one of the most mature and widely deployed web servers in existence. The decision to replace Nginx was not made lightly. Nginx had served Cloudflare well, and its stability was well established.
The motivation for replacement came from architectural limitations. Nginx uses a multi-process model where each worker process maintains its own event loop and connection pools. This architecture is elegant and effective, but it creates silos. Connection pools cannot be shared across worker processes, meaning Cloudflare was maintaining far more connections to origin servers than necessary. When a request arrived at worker process A but the only cached connection to the target origin was held by worker process B, a new connection had to be established.
This connection proliferation had real costs. More connections meant more TLS handshakes, higher memory consumption, increased latency for cache misses, and greater load on origin servers. Cloudflare estimated that sharing connection pools could reduce connections to origin servers dramatically.
Pingora: Architecture and Implementation
Pingora, written in Rust, uses a multi-threaded architecture within a single process. This design, enabled by Rust's Send and Sync traits and its ownership model, allows connection pools to be safely shared across all threads. The borrow checker ensures that concurrent access to shared resources is correct at compile time, eliminating the data races that would be a constant concern if the same architecture were implemented in C or C++.
The results were striking. Cloudflare reported that Pingora reduced new connections to origin servers by 77 percent compared to the Nginx-based infrastructure. CPU consumption dropped by approximately 70 percent, and memory usage fell by about 67 percent for equivalent traffic loads. These improvements came not from Rust being inherently faster than C (both languages compile to similarly efficient machine code) but from the architectural changes that Rust's safety guarantees enabled.
Pingora also delivered operational benefits. Rust's type system and error handling model (using Result types rather than error codes or exceptions) made the codebase more maintainable and easier to reason about. New engineers onboarding to the Pingora codebase could understand the system's invariants by reading the types, and the compiler prevented them from violating those invariants. This reduced the rate of bugs introduced during development and simplified code review.
In September 2024, Cloudflare open-sourced Pingora, making the framework available for other organizations to build high-performance proxy and networking applications. This decision reflected confidence in the framework's maturity and a desire to contribute back to the Rust ecosystem that had enabled Pingora's development.
Lessons Learned at Cloudflare
Cloudflare's experience demonstrated that Rust's safety guarantees can enable architectural improvements that would be too risky in unsafe languages. The shift from multi-process to multi-threaded architecture for a system handling millions of requests per second would have been extraordinarily dangerous in C. Data races, deadlocks, and memory corruption bugs in concurrent code are notoriously difficult to detect through testing alone. Rust's compile-time concurrency safety made this architectural leap feasible, and the performance improvements that resulted were a direct consequence.
Cloudflare also showed that Rust can replace battle-tested infrastructure when the replacement is motivated by genuine architectural advantages rather than novelty. Nginx was replaced not because it was buggy or unmaintained but because its architectural model could not efficiently address Cloudflare's specific requirements for connection sharing at scale.
Discord: Eliminating Latency Spikes in Real-Time Systems
Discord's Rust adoption story is distinctive because it centers on a specific, measurable performance problem: garbage collection latency spikes in their Go-based services.
The Go Latency Problem
Discord originally built many of their backend services in Go, a language that served them well during rapid growth. However, as their user base expanded and the scale of their real-time messaging infrastructure grew, they encountered a recurring problem. Go's garbage collector, while highly optimized, introduced periodic latency spikes during collection cycles. For most applications, these pauses of a few milliseconds are imperceptible. But for Discord's real-time messaging service, where users expect messages to appear instantaneously, even small latency spikes were noticeable and degraded the user experience.
The issue was particularly acute in Discord's "Read States" service, which tracks which messages each user has read across all their channels. This service handled enormous throughput as millions of concurrent users opened channels, scrolled through conversations, and sent messages. The data structures maintained by this service were large and long-lived, which increased the work the Go garbage collector needed to perform and made collection pauses more frequent and longer.
The Rust Rewrite
Discord's engineering team rewrote the Read States service in Rust. The rewrite eliminated garbage collection entirely, replacing Go's managed memory with Rust's ownership-based memory management. The results were immediate and dramatic.
The Rust implementation reduced average response times and, critically, eliminated the latency spike pattern entirely. Without garbage collection pauses, the service's response time distribution became smooth and predictable. P99 latencies, which represent the worst-case experience for 1 in 100 users, improved substantially. The Rust service also consumed less memory than the Go implementation because Rust's ownership model enabled more precise control over memory allocation and deallocation patterns.
Discord's engineering team noted that the Rust implementation was also faster in aggregate throughput, not just tail latency. Rust's zero-cost abstractions and lack of runtime overhead meant that each operation completed more quickly, even in the common case where garbage collection was not active in the Go version.
Discord Read States Service: Go vs Rust
Rust Implementation
Go Implementation
Beyond Read States
Following the success of the Read States rewrite, Discord expanded Rust adoption to other services. Their infrastructure team built new services in Rust by default for performance-critical workloads, and the language became a core part of Discord's technology strategy. The success of the initial rewrite built organizational confidence in Rust and demonstrated that the investment in learning the language paid concrete dividends.
Lessons Learned at Discord
Discord's case study is valuable because it demonstrates Rust's advantages over garbage-collected languages specifically, rather than just over C and C++. Many organizations considering Rust are coming from Go, Java, or C# rather than from C/C++. Discord's experience showed that Rust can deliver meaningful performance improvements even compared to modern, well-designed garbage-collected languages, particularly for workloads where predictable latency is critical.
Discord also showed that targeted rewrites of specific services can be an effective adoption strategy. They did not rewrite their entire backend in Rust. They identified the service where Rust's characteristics would have the greatest impact, rewrote that service, measured the results, and then expanded adoption based on the proven value.
The Linux Kernel: Rust Enters the Cathedral
Perhaps the most symbolically significant Rust adoption is its acceptance into the Linux kernel. The kernel is the most important and widely deployed C codebase in the world, running on everything from smartphones to supercomputers. Introducing a second language into this codebase required navigating not just technical challenges but decades of community culture and process.
The Path to Acceptance
The effort to bring Rust to the Linux kernel began in earnest around 2020, led by Miguel Ojeda with support from Google, which funded his work through the Internet Security Research Group's Prossimo initiative. The proposal was to allow kernel modules, particularly device drivers, to be written in Rust while maintaining C as the primary language for the core kernel.
The technical argument was straightforward. Device drivers account for a disproportionate share of kernel bugs and security vulnerabilities. Drivers parse complex hardware protocols, handle untrusted input from devices, and run in kernel space where any bug can compromise the entire system. Rust's memory safety guarantees could eliminate entire categories of driver bugs, improving the reliability and security of the kernel without requiring changes to existing C code.
The cultural argument was more contentious. Linus Torvalds and other senior kernel maintainers initially expressed skepticism about introducing a new language, citing concerns about increased complexity for maintainers, the stability of Rust's compiler and language specification, and the additional toolchain requirements. These concerns were addressed through years of patient engineering work, including developing safe Rust abstractions over kernel APIs, demonstrating that Rust code could coexist cleanly with C code, and proving the stability of the Rust toolchain for kernel development.
Rust for Linux in Practice
In October 2022, Rust support was merged into Linux 6.1. This initial support included the infrastructure needed to compile Rust code as part of the kernel build, safe abstractions over basic kernel primitives, and a sample Rust module demonstrating the integration. The scope was deliberately limited, providing a foundation that could be expanded incrementally.
Since the initial merge, Rust support in the kernel has continued to expand. Rust abstractions have been developed for additional kernel subsystems including networking, file systems, and device model APIs. Several companies have contributed Rust-based kernel modules, including drivers for specific hardware and implementations of kernel subsystems.
The Rust for Linux project defined a pattern where unsafe Rust code wraps raw kernel C APIs in safe abstractions, and then kernel modules written in safe Rust use these abstractions. This layered approach concentrates the unsafe code in a small, carefully audited layer while allowing the bulk of driver code to benefit from Rust's safety guarantees.
Lessons Learned from the Linux Kernel
The Linux kernel experience demonstrated that Rust can be introduced into even the most established and culturally conservative C codebases. The key was patient, incremental progress. Rather than proposing a wholesale language transition, the Rust for Linux project focused on enabling new code to be written in Rust while respecting the existing C codebase and the preferences of maintainers who preferred to continue working in C.
The kernel experience also highlighted the importance of safe abstraction layers. By concentrating unsafe code in a thin layer of bindings and exposing safe Rust APIs to module developers, the project maximized the safety benefits of Rust while minimizing the surface area that required careful manual verification.
Rust for Linux Project Launches
Miguel Ojeda begins formal effort to bring Rust to the Linux kernel, funded by Google through ISRG Prossimo.
RFC and Community Discussion
Rust for Linux RFCs spark extensive discussion in the kernel community about language integration patterns.
Merged into Linux 6.1
Rust support officially merged into the mainline kernel, including build infrastructure and safe kernel API abstractions.
Subsystem Abstractions Expand
Rust abstractions developed for networking, file systems, and device model APIs.
Production Drivers Emerge
Companies begin shipping Rust-based kernel modules for production hardware, validating the ecosystem's maturity.
Cross-Cutting Themes: Patterns Across All Adoptions
Examining these case studies together reveals several consistent patterns in how large organizations adopt Rust and the outcomes they achieve.
Migration Strategies That Work
Every successful Rust adoption followed one of two strategies: writing new components in Rust from scratch or performing targeted rewrites of specific components with well-defined boundaries. No company attempted a wholesale rewrite of its entire codebase. The risks and costs of large-scale rewrites are well understood in software engineering, and Rust adoption is no exception.
The "new code in Rust" strategy, exemplified by Google's approach on Android, proved particularly effective. By ensuring that all new native code was written in Rust while leaving existing C/C++ code untouched, Google achieved a gradual, natural transition. The proportion of Rust code in the codebase grew over time, and the rate of memory safety vulnerabilities declined correspondingly.
The targeted rewrite strategy, exemplified by Discord's Read States service and Cloudflare's Pingora, worked well when there was a specific, measurable problem that Rust could address. These rewrites were justified by concrete performance or security requirements rather than general language preference, which made it easier to secure organizational buy-in and measure success.
The Interoperability Imperative
Every company investing in Rust also invested heavily in interoperability tooling. Rust does not exist in isolation. It must coexist with existing C, C++, Go, and Java codebases, participate in existing build systems, and integrate with existing debugging and profiling tools. The quality of this integration often determined the success or failure of Rust adoption more than any property of the language itself.
Microsoft built custom tooling for Windows kernel API bindings. Google developed interoperability frameworks for Android and Chromium. Meta ensured that Buck2 could build Rust alongside every other language in their monorepo. Cloudflare integrated Pingora into their existing deployment and monitoring infrastructure. In each case, significant engineering effort went into making Rust a seamless part of the existing development ecosystem rather than a foreign element that required special handling.
Measured Results
The organizations that adopted Rust measured their results rigorously. Google tracked memory safety vulnerability rates in Android year over year. Cloudflare measured CPU consumption, memory usage, and connection counts before and after the Pingora deployment. Discord measured response time distributions including tail latencies. AWS measured VM boot times, memory overhead, and security audit findings.
This emphasis on measurement served two purposes. It validated the technical decision, confirming that Rust delivered the expected benefits. And it built organizational support for continued adoption by providing concrete evidence that the investment was worthwhile. Engineering leaders considering Rust adoption would do well to define their success metrics before beginning and track them throughout the migration.
| year | microsoft | amazon | meta | cloudflare | |
|---|---|---|---|---|---|
| 2019 | 12 | 8 | 20 | 5 | 10 |
| 2020 | 18 | 15 | 30 | 10 | 18 |
| 2021 | 28 | 35 | 42 | 25 | 30 |
| 2022 | 40 | 55 | 55 | 45 | 50 |
| 2023 | 55 | 70 | 68 | 60 | 65 |
| 2024 | 68 | 82 | 78 | 72 | 75 |
Organizational Challenges and How Companies Overcame Them
Adopting Rust at scale involves organizational challenges that are at least as significant as the technical ones. Understanding how major companies addressed these challenges provides practical guidance for organizations considering their own Rust adoption.
Developer Training and the Learning Curve
Every company that adopted Rust acknowledged that the learning curve is real and significant. The borrow checker enforces a mental model of memory management that is fundamentally different from both manual memory management in C/C++ and garbage-collected memory management in Java/Go/C#. Developers must internalize concepts like ownership transfer, borrowing, lifetimes, and the distinction between mutable and immutable references.
Microsoft found that experienced systems programmers needed three to six months to become productive in Rust. Google invested in comprehensive internal training programs and paired new Rust developers with experienced mentors. Meta built internal documentation, coding guidelines, and example projects to accelerate onboarding. Discord encouraged developers to start with smaller, less critical projects before tackling production services.
The consistent finding across all companies was that while the initial learning investment was substantial, the long-term productivity was competitive with or superior to C and C++. The borrow checker catches at compile time bugs that would otherwise require hours of debugging, and Rust's expressive type system and pattern matching reduce the amount of boilerplate code. Developers who pushed through the initial learning curve consistently reported that they were more productive and more confident in the correctness of their code.
Build System and Toolchain Integration
Integrating Rust into existing build systems proved to be one of the most practically challenging aspects of adoption. Large technology companies typically have highly customized build systems that support multiple languages, complex dependency graphs, and sophisticated caching and distribution mechanisms. Adding Rust support to these systems required significant engineering effort.
Meta's situation was perhaps the most complex: Buck2, their Rust-based build system, needed to build Rust itself as one of the languages it supported. Google integrated Rust into their Bazel-based build infrastructure, requiring custom rules for Rust compilation, linking, and testing. Microsoft added Rust support to their internal build system while also ensuring compatibility with Visual Studio and their debugging infrastructure.
The Cargo ecosystem, while excellent for standalone Rust projects, was often not directly suitable for integration into corporate monorepo build systems. Companies needed to bridge the gap between Cargo's convention-based project structure and their existing build infrastructure. This typically involved using Cargo for dependency resolution and crate management while delegating actual compilation to the corporate build system.
Hiring and Ecosystem Growth
When these companies began their Rust adoption efforts, the pool of experienced Rust developers was relatively small compared to C++, Java, or Go. Companies addressed this through a combination of internal training (converting existing engineers) and targeted hiring. As Rust's popularity grew, driven in part by these high-profile corporate adoptions, the talent pool expanded significantly.
The Rust community's growth has been remarkable. Stack Overflow's developer survey consistently ranks Rust as the most loved programming language. The number of published crates on crates.io has grown exponentially. University courses on systems programming increasingly include Rust alongside or instead of C. These trends suggest that the talent availability challenge will continue to diminish as the ecosystem matures.
The Broader Impact: What This Means for the Industry
The convergence of so many major technology companies around Rust has implications that extend beyond the individual organizations involved.
A New Default for Systems Programming
The cumulative effect of these adoptions is establishing Rust as the default choice for new systems programming projects. When Microsoft, Google, Meta, Amazon, Cloudflare, and the Linux kernel all validate a language for production systems work, it sends a powerful signal to the rest of the industry. Engineering teams at smaller companies can point to these precedents when justifying their own Rust adoption.
This does not mean C and C++ are disappearing. Billions of lines of existing code will continue to be maintained in these languages for decades. But the trend is clear: for new systems-level projects where safety and performance are both priorities, Rust is increasingly the first language considered.
The Memory Safety Movement
These corporate adoptions have accelerated a broader industry movement toward memory safety. The US government's formal recommendations for memory-safe languages, the Linux kernel's acceptance of Rust, and the consistent messaging from major tech companies about the costs of memory safety bugs have shifted the conversation. Memory safety is no longer an academic concern or a niche interest. It is a mainstream engineering priority.
Ecosystem Maturation
The investment by major companies has dramatically accelerated the maturation of the Rust ecosystem. Companies have contributed to critical infrastructure crates, funded core language development through the Rust Foundation, and open-sourced internal tools and frameworks. Cloudflare's release of Pingora, Meta's release of Buck2, and AWS's release of Firecracker have enriched the ecosystem with battle-tested, production-quality software.
| company | areas |
|---|---|
| Microsoft | 4 |
| 5 | |
| Meta | 3 |
| Amazon | 5 |
| Cloudflare | 4 |
| Discord | 2 |
| Linux Kernel | 3 |
Practical Guidance for Organizations Considering Rust
Drawing from the experiences of these technology giants, several practical recommendations emerge for organizations evaluating Rust adoption.
Start With New Projects, Not Rewrites
The most consistently successful strategy was writing new components in Rust rather than rewriting existing ones. New projects avoid the risks and costs of migration while immediately capturing Rust's safety and performance benefits. As new Rust code accumulates alongside existing code in other languages, the organization builds expertise and the proportion of memory-safe code grows naturally.
Invest in Interoperability First
Before writing production Rust code, invest in making Rust a first-class citizen in your build system, CI/CD pipeline, and debugging tools. The friction of working with a language that does not integrate smoothly with existing infrastructure will slow adoption and frustrate developers. The investment in tooling integration pays dividends throughout the adoption process.
Define and Measure Success Metrics
Identify the specific problems you expect Rust to solve before you begin. Whether it is reducing memory safety vulnerabilities, eliminating GC-related latency spikes, or improving resource efficiency, having concrete metrics allows you to validate the decision and build organizational support for continued adoption.
Build Internal Expertise Gradually
Do not try to train your entire engineering organization in Rust simultaneously. Start with a small team of enthusiastic early adopters, give them a well-scoped project, and let them develop expertise and best practices that can be shared with the broader organization. These early adopters become internal advocates and mentors who accelerate the learning curve for subsequent adopters.
Expect the Borrow Checker Learning Curve
The borrow checker will slow developers down initially. This is expected and temporary. Provide training resources, mentorship from experienced Rust developers, and patience. The productivity gain on the other side of the learning curve, where the compiler catches bugs that would otherwise require extensive debugging, is substantial and well-documented.
Conclusion
The story of Rust adoption at the world's largest technology companies is not a story about a trendy new programming language. It is a story about engineering organizations confronting a decades-old problem, the inadequacy of existing tools for writing safe systems software, and converging on a solution that fundamentally changes the safety-performance tradeoff.
Microsoft adopted Rust to secure the Windows kernel and Azure infrastructure. Google embedded Rust into Android, Chromium, and Fuchsia to reduce vulnerability rates. Meta rebuilt its build system and source control infrastructure for performance and reliability. Amazon built the virtualization layer that powers serverless computing. Cloudflare replaced Nginx to enable architectural improvements that were too risky in C. Discord eliminated latency spikes that degraded real-time communication. The Linux kernel accepted Rust to improve the safety of device drivers.
Each of these decisions was made independently, through different decision-making processes, by different engineering organizations facing different constraints. The convergence on Rust was not coordinated. It emerged from a shared recognition that the language's combination of memory safety, zero-cost abstractions, and fearless concurrency offered something genuinely new: a way to write systems software that is both safe and fast, without choosing between the two.
For engineering leaders evaluating language strategy, the evidence from these case studies is clear. Rust is not a risk for systems programming. It has been validated at the highest scale, in the most demanding environments, by the most sophisticated engineering organizations in the world. The question is no longer whether Rust is ready for production. It is how to adopt it effectively within the specific constraints and priorities of your organization.

