437 points by sgramaccia 6 months ago flag hide 11 comments
johnwise 6 months ago next
Excellent writeup! I've been considering migrating some services to Rust and gRPC. Do you have any suggestions on how to start with the process?
johndoe 6 months ago next
Start by getting familiar with the language and its ecosystem. The Rust community has great resources to help you along the way. Maintainable code and a gradual learning path are key. You don't want to end up with a big ball of mud. Regarding the performance, check out this benchmarking tool <https://github.com/bheisler/bencher>.
sweb 6 months ago next
I love Rust's approach to zero-cost abstractions. It makes migrating to the language very smooth. We've open-sourced one of our projects that was migrated to Rust if you're interested <https://github.com/myorg/project>.
randomdev 6 months ago prev next
Great article, thanks for sharing. I'm curious, how did you measure the performance improvements after switching to Rust and gRPC?
pgodbole 6 months ago next
We used a combination of stress testing and application-specific performance metrics. We also made sure our unit tests and integration tests included performance checks. This ensured that performance degradation would be detected even if the correctness of the application was not affected. For benchmarking, you could use something like this <https://github.com/estesp/bencho>. Sidenote: the ability to run tests in parallel is also key.
bcjordan 6 months ago next
That's a solid approach. Using performance checks in tests is a good practice, especially considering the risk of introducing performance regressions with refactorings. Often, devs are more concerned with functional correctness than performance.
acmeengineer 6 months ago prev next
Really informative post! How did you manage the communication overhead with multiple microservices using Rust and gRPC?
rostam 6 months ago next
We minimized the overhead by using a well-defined protobuf schema for communication between services. When using gRPC, the protobuf definitions generate client and server bindings for the Rust side. This made it easy to interact between services while still maintaining type safety. It's essential to use connection pooling for network resources as well for better scalability.
devopspro 6 months ago prev next
Anyone know of a good load balancer that works well with Rust and gRPC? I've been trying out Envoy and Traefik but I'd like to hear some alternative suggestions.
fopensource 6 months ago next
I haven't used Rust with any other load balancer except Envoy. It's quite modular and easy to configure using YAML files. I recommend giving it a try if you haven't already. I believe Traefik has gRPC support too now, check out their docs see if it meets your requirements <https://doc.traefik.io/traefik/v2.0/routing/services/#gprc>.
joydeep 6 months ago prev next
We've had success with Linkerd. It's written in Rust and specifically designed for workloads running on Kubernetes clusters. One of my favorite features of Linkerd is the automatic observability of all Java, gRPC, HTTP 1.1, and HTTP/2 connections, so you don't need to manually add instrumentation to your code. It's also performant and has low resource requirements.