This article was written in collaboration with Chris Konstad, a Production Engineer at Facebook.
For today’s interview, we have Chris Konstad who is a Production Engineer on the Video Infrastructure team at Facebook. The Video Infrastructure team builds world-class video infra comprising live streaming, video processing, transcoding, storage and more to ensure that we are able to deliver the best video experience on Facebook. While working on this team, Chris has been using Rust as one of the main languages for development. He works on our copyright and integrity audio and video matching systems, where he focuses on running our algorithms at scale. Let’s hear from him about how his experience with Rust has been and learn more about his work.
I wrote my team's CLI tooling with Rust. It provides a human-friendly and scriptable interface to my team's services in one package. Our CLI helps everyone on my team, from the systems engineers debugging issues in production to the algorithm developers that need to run large scale algorithm evaluations.
We chose Rust because of the great variety of libraries and features that make writing complex CLIs a breeze:
Before writing that tool in Rust, I tried to use Python to write a one-off migration script for a large scale database migration. Between problems with asyncio, and unforeseen exceptions, it was hard to achieve a fire-and-forget binary that could process the amount of data that we needed to process without stopping, which would slow down our migration. I ported the tool to Rust, and it was a great experience, with incredible reliability. Ever since then, I've been advocating that we write our tools, and eventually services, in Rust. Forgetting all other benefits, I think that Result and Option help my team avoid 75% of the problems we'd otherwise run into in production.
I believe that Rust is taking off at Facebook. It's been a long process, but it is gathering more steam every week. It's awesome to watch. By working on tooling that can lower the barrier of linking to C++ libraries, I'm seeing more and more internal library support without requiring any re-implementation.
Facebook's work on cxx in particular is incredibly valuable to organizations that want to bring Rust into an existing C++ codebase. I hope to see more investment in the space, because I think Rust is particularly well-positioned to take over the systems programming space. I say this as an engineer who started off focused on writing distributed systems in C++.
I think it's because Rust gives you the power and (most of) the flexibility of a low-level language like C++ or C, but with the safety and expressiveness of higher level languages. I believe it leverages decades of programming language design research and experience to pull together a language and tooling environment that is awesome to use. Working with the compiler is like working with a coworker who is answering most of your questions and pointing out bugs you wrote before you noticed them.
I can't choose a favorite feature about Rust, there are too many.
Check out the Rust book, and Rust by example. Additionally, there are some really great videos on YouTube about creating libraries in Rust. One of my favorites is creating a channel implementation in Rust from scratch.
We would like to thank Chris, for taking the time to do this interview. It was very interesting to learn how Rust is being used as a primary language to build CLI tooling and how we are learning from all the things we build here and contributing back to the Rust community for others to benefit from this as well. 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 many more 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. 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.
Interested in working with Production Engineering at Facebook? Check out our job postings on our Production Engineering career page here.