This article was written in collaboration with Eric Kuecks, a Production Engineer at Facebook.
For today’s interview, we have Eric Kuecks who is a Production Engineer on the Core Data Staging team at Facebook. The Core Data Staging team works on integration testing for the cache and database stack at Facebook. While working on this team, Eric has been using Rust as one of the main languages for development. Most of his work these days centers around preventing site outages by enabling more extensive testing of our systems. Let’s hear from him about how his experience with Rust has been and learn more about his work.
While working on my current team, I've transitioned to using Rust on a predominantly Python code base for some of our command line interfaces and servers and am now starting a new team where we hope to use Rust extensively. While on my previous team, I also wrote some Python extensions in Rust in order to incorporate it into an existing Python code base as well as wrote new services in Rust.
We were coming from Python and not having a compiler was a huge pain. We had a lot of runtime bugs that could have otherwise been easily caught by any compiled language. We also faced performance issues since Python was pretty slow, especially since multithreading doesn't help CPU-bound work due to the limitations posed by the GIL (Global Interpreter lock). We wanted a compiled language that could interop with Python, since it's much easier to incrementally replace our stack than start from scratch, which left us with either C++ or Rust.
I think it is much easier to go from nothing to correct code in Rust than it is C++. I would argue this is true even if you "know" C++ as well, since it has so many footguns with undefined behavior. Rust on the other hand, has no undefined behavior (outside of unsafe code). This made Rust a clear winner from a practical standpoint. Rust language features like traits and enums were a nice bonus on top since they are way better than what C++ can offer. From there I decided to use it for other projects outside of Python extensions as well, since it's just a really good language.
I have worked on the server to handle deploying TAO (The Associations and Objects), a social graph cache at Facebook. TAO is the main way the front end code accesses the social graph data. This involved integration with Conveyor, our continuous deployment system, several libraries with Python bindings to be used by tools, a library with CXX bindings to be used by C++ and a few small CLI tools.
I'm super happy with the support the language gets from a few very dedicated people. I have seen it take off a lot among production engineers and would like to see more software engineers use it, especially those who currently use C++.
We have some fantastic Rust developers here at Facebook who work on amazing open source projects. An example would be CXX, which is very useful and drastically improves the experience for developers using Rust. We have also recently published rust-shed, which contains Rust crates that are common between Facebook open source projects. We are also looking forward to having a lot of opportunities to contribute to the rustc compiler.
A lot of big companies are hiring for Rust work which I think will cause a lot of others to follow. I think Rust is starting to transition from being viewed as a niche language for enthusiasts to a serious language that should be considered for almost any project.
There is a lot to love about Rust, but I think people will like different aspects of it depending on what language they are coming from. I was coming from a background of writing Facebook Python which is "compiled" with Buck but does not have the full benefits of a real compiler. Rust's amazing compiler certainly stands out as an exceptional feature to me. It's incredible how often my code is completely correct once it compiles. A close second are Rust sum type enums (tagged unions) which I always miss when I use another language.
We would like to thank Eric, for taking the time to do this interview. It was very interesting to learn how Rust is being used as a primary language for integration testing and how we are learning from all the things we build here and contributing back to the Rust community. We hope you found this interview useful and it gave you some insight into how and where Rust is being used at Facebook. Look out for more interview blogs where we meet with other engineers and hear their thoughts on this topic.
Rust has consistently been ranked as the “most loved” language for the last 5 years and we at Facebook believe that Rust is an outstanding language that shines in critical issues such as memory safety, performance and reliability and is being used widely over a large range of projects here. We joined the Rust Foundation to help contribute towards the improvement and growth of Rust, which not only strengthens our commitment towards the Rust language but also towards a sustainable development of open source technologies and developer communities across the world.
This blog is a part of our Meet the Rustaceans series, where we invite the engineers and developers who use Rust on a regular basis to share their experiences and tell us about the amazing products that they are building using Rust here at Facebook. Look out for more interview blogs where we meet with many more engineers and hear their thoughts on this topic.
Interested in working in Production Engineering at Facebook? Check out our job postings on our Production Engineering career page here.