Let’s be honest. When we talk about migrating a service to Rust, we all envision the same thing: liquid-lightning latency, CPU graphs dropping off a cliff, and a single server suddenly handling the traffic of a small European nation.
Momento spent over three years rewriting its services from Kotlin to Rust. They expected raw speed. What they actually got was a massive upgrade to their engineering sanity.
Here is what actually happens when you ditch the JVM for the crab emoji.
1. The Compiler is Your Aggressive Pair Programmer
In Kotlin, you swap an account_id and a user_id because they are both strings. Your IDE doesn't care. Your reviewer misses it. Production explodes at 2 AM.
In Rust, the compiler treats you like a suspect in a crime scene. By forcing engineers to declare custom types and explicitly deal with references, entire categories of bugs are vaporized before they even touch a Pull Request.
[ Your Brain ] -> "I'll just share this variable real quick..."
[ The Borrow Checker ] -> "Over my dead body."
Yes, the learning curve looks like a vertical wall. But fighting the compiler on your laptop is infinitely better than fighting a memory leak in production.
2. Plot Twist: Rust Doesn't Automatically Fix Bad Code
If you write a bad algorithm in Python, it’s slow. If you write a bad algorithm in Rust, it is safely, concurrently, and beautifully slow.
Momento’s first Rust rewrite didn't magically reduce latency. Why? Because the code was still doing silly things, like repeatedly allocating dynamic string memory for metrics inside the main request path.
They still had to bust out flamegraphs and Criterion to fix poor lock designs and profile hot paths. Rust stops you from shooting yourself in the foot, but it won't write your code for you.
3. The Real Flex: Throughput & The Cloud Bill
While latency didn't drop instantly, instance throughput absolutely skyrocketed.
Momento went from handling 20,000 requests per second to 100,000 on a single instance.
Traditional scaling: "Throw more AWS instances at it!"
Rust scaling: "We deleted 80% of our servers and the app is fine."
When you are an infrastructure company, that kind of resource efficiency makes finance executives weep tears of joy. In fact, they later picked Rust for a workflow service that wasn't even performance-sensitive, just because they loved the explicit code and consistency.
4. How to Adopt Rust (Without Firing Your Team)
Momento didn’t rewrite their entire core infrastructure on day one. They started small:
- They built a tiny internal CLI tool.
- They migrated one performance-critical hot spot.
- They leaned heavily on one "Rust Guru" who already understood lifetimes and async patterns to prevent the rest of the team from crying over compiler errors.
The Takeaway
Rust isn't a magical performance engine that fixes lazy engineering. It is an engineering safety net. It gives your team the confidence to experiment, refactor, and push changes without the constant lingering dread that everything is about to break.