Counter Service: How we rewrote it in Rust
Jun 20, 2025Jia Long Loh

Summary
The Counter Service, previously using Golang and Scylla/Redis/DynamoDB/MySQL, has been rewritten in Rust. This rewrite achieved 70% infrastructure savings while maintaining similar performance. The team selected Rust due to its efficiency and memory safety, and chose the Counter Service for rewrite due to its 'simple' functionality and high traffic. The rewrite involved using Rust libraries for GRPC (Tonic), web server (Actix-web), Redis (fred.rs), Kafka (kafka-rust), and Scylla (scylla-rust-driver). Internal Go templating was replicated using the Nom parser combinator. Challenges included adapting to the borrow checker and async gotchas, which were managed by initially using clones/Arc and focusing on cooperative scheduling.