Rust or C++: deciding on a migration and backing it with numbers
The question "Rust or C++" is no longer about syntax. It is a decision about whether the team will be able to maintain the product three years from now, when the codebase has grown tenfold. Rust offers a strict type system, a borrow checker and clear tooling, which reduces risk in critical services. But the strictness of a language is not, by itself, an argument for migration: we treat this decision as a product problem, answered through a pilot, metrics and economics over a two-year horizon. Below are the criteria, the plan and the numbers we rely on in practice.
Over the last two years we have seen companies move Rust from a "sandbox" to the foundation of high-load platforms. The common thread is lower operational risk thanks to a predictable runtime and earlier detection of errors.
When a migration is justified
- Memory safety: a crash in production costs millions.
- Parallel computation and complex IO.
- You need a predictable runtime without hidden GC pauses.
- Strict regulatory requirements: fintech, medtech, industrial controllers.
We migrated a telemetry module from C++ to Rust: thanks to async/await and strong typing, the incident rate dropped by 60% and development speed went up.
Skills and organizational risks
The most important thing is to train the team. Before migrating the core, introduce Rust on the periphery: CLI tools, integration services. After 3-4 months developers get used to the borrow checker, and the transition goes smoothly.
A training plan usually includes internal meetups, pair programming and mandatory code reviews with a mentor. A "Rust guild" remains a good practice: a group of experts that supports the other teams and shapes the guidelines.
Technology stack
- Toolchain:
rustup, stable builds,cargo-denyagainst supply-chain risks. - CI/CD:
cargo fmt,clippy --deny warnings,cargo audit,nextest. - Observability:
tracing,opentelemetry, integration with Prometheus. - Interop: FFI through
cxxoruniffi, safe boundaries with legacy code.
Strong tooling is an argument for the CTO: the cost of building DevEx tooling is noticeably lower than in the C++ world.
The economics of the move
Executives worry that a migration will "eat" the roadmap, but practice shows the opposite. We calculate TCO over a two-year horizon: fewer bug fixes and shorter release cycles outweigh the cost of training and refactoring. The team burns out less because it fights a product problem, not a segfault. The CFO sees it in the numbers: incident response time goes down, the SLA stabilizes, penalties disappear.
For startups the savings show up as speed to market. Hiring Rust developers is harder, but mid-level engineers reach productivity faster, without fear of "breaking memory". As a result the roadmap stops slipping because of a snowball of technical debt.
Pilot and metrics
- Choose an isolated service where metrics are easy to measure.
- Assemble a guild of internal evangelists and mentors.
- Automate CI: clippy, fmt and a security audit as a mandatory bundle.
- Record metrics before and after: MTTR, number of incidents, release speed.
- Track engineering OKRs: test coverage, code review speed, share of unsafe.
After the pilot, assess how much of the knowledge can be scaled to the rest of the platform. It often turns out that the most expensive part is not the code but the processes: design reviews, dependency control, a culture of ownership. Rust imposes discipline on them to such a degree that even teams on other languages adopt the practices.
Case: IoT telemetry
A product company in the IoT industry rewrote its ingest pipeline. The scenario: millions of devices, tight limits on power consumption and offline mode. The C++ implementation suffered from race conditions and difficult library deployment.
- We rewrote the ingestion agent in Rust, keeping the C++ core for signal processing.
- We introduced a contract through FFI and
cxx::bridgeto guarantee type safety. - We migrated the protocols to
tokio+serde+prost. - We automated tests on embedded hardware with
probe-rs.
The result: peak load was handled with room to spare, the number of production bugs dropped 5x, and the team cut release time from 3 weeks to 4 days.
Migration roadmap
| Stage | Focus | Key artifacts |
|---|---|---|
| 0. Preparation | Training, tooling selection, dependency audit | Tech radar, guidelines, CI templates |
| 1. Periphery | CLI, integration services, SDKs | FFI contracts, library templates |
| 2. Critical path | High-load modules, network stacks, asynchronous pipelines | Set of metrics, chaos testing, dashboards |
| 3. Consolidation | Removing legacy, reusing components | Monorepos, shared runtime toolkit |
The roadmap helps explain why the transition takes 12-18 months, and where exactly the return for the business comes from.
Risks and how to mitigate them
- Shortage of specialists: grow internal programs and partner with universities.
- Unmaintained libraries: do due diligence and invest in open source.
- Management concerns: show the numbers for MTTR, SLA and release predictability.
- Difficulty migrating legacy code: use FFI "pockets" and gradual rewriting.
- Regulatory requirements: certify critical libraries and document the processes.
Rust is not a magic wand, but it disciplines the team and the processes to the point that the "cost of a mistake" drops several times over. This is a strategic advantage that is hard to replicate if you keep living in the C++98 era. And for how Rust and Zig already prove themselves in everyday applications, from the Zed editor to the Ghostty terminal, read "Rust and Zig in familiar applications".