Meet the Rustaceans: Chris Konstad
This article was written in collaboration with Chris Konstad, a production engineer at Facebook.
For today’s interview, we have Chris Konstad, a production engineer on Facebook’s Video Infrastructure team. The Video Infrastructure team creates world-class video infra that includes live streaming, video processing, transcoding, storage and more to ensure we can deliver the best video experience on Facebook. While working on this team, Chris has used Rust as one of the main development languages. He works on our audio and video copyright and integrity matching systems, focusing on running our algorithms on a large scale. Let us hear from him how he experienced Rust and learn more about his work.
In what capacity did you use Rust?
I wrote my team’s CLI tool using Rust. It provides an easy-to-use and scriptable interface to my team’s services in one package. Our CLI helps everyone on my team, from the systems engineers debugging problems in production to the algorithm developers who need to perform extensive algorithm assessments.
Why did you / your team use Rust over other languages on Facebook?
We chose Rust because there are a variety of libraries and functions that make writing complex CLIs a breeze:
- Structopt is great for parsing CLI arguments and can be used to generate detailed –help messages
- Indicatif is great for showing people how advanced their job is
- The Async / Await syntax makes writing async code (which is the bulk of this CLI) very smooth
Before writing this tool in Rust, I tried using Python to write a one-time migration script for a large-scale database migration. Between issues with Asyncio and unforeseen exceptions, it was difficult to create a fire-and-forget binary that could handle the amount of data we needed to process without stopping, which would slow our migration. I ported the tool to Rust and it was a great experience with incredible reliability. Since then I have worked to ensure that we write our tools and ultimately our services in Rust. I forget all the other benefits and think that outcome and option will help my team avoid 75% of the problems we would otherwise have encountered in production.
What projects you’ve worked on at Facebook that use Rust?
- My team’s CLI tool
- I briefly worked on a project that used Rust for server provisioning during a hackamonth on Facebook
- I have volunteered my time to work on various Rust shared libraries
How do you rate Rust’s growth path on Facebook?
I believe Rust is taking off on Facebook. It’s been a long process, but it’s gaining more steam every week. It’s great to see. By working on tools that can lower the barrier to linking to C ++ libraries, I see more and more in-house library support without the need for redeployment.
How valuable is Facebook to Rust?
Facebook’s work on cxx, in particular, is incredibly valuable for companies looking to integrate Rust into an existing C ++ code base. Hope to see more investment in the space as I think Rust is particularly well positioned to take over the systems programming space. I say this as an engineer who initially focused on writing distributed systems in C ++.
How do you think Rust will grow as a language in 2021?
- Support for cxx results in simpler / more trivial bindings to C ++ code, which means that it is much easier to partially adopt Rust code
- It seems that more and more people are working on Rust professionally, which is going to be great for the ecosystem. I believe these resources will be the turning point for Rust’s adoption.
Some people who have used Rust really liked it. Why do you think that is the case and what is your favorite feature of Rust?
I think that’s because Rust gives you the power and (most of) flexibility of a simple language like C ++ or C, but with the security and expressiveness of higher languages. I believe it uses decades of research and programming language design experience to put together a language and tooling environment that is fantastic to use. Working with the compiler is like working with a colleague who will answer most of your questions and point out bugs you wrote before you noticed them.
I can’t pick a favorite feature about Rust, there are too many.
- Compilation time guarantees (option, result, loan)
- Macros leading to some awesome libraries (cxx, structopt)
- Iterator API
- .await is really good for concatenating
Where can people find out more about Rust and how can they contribute?
Take a look at the Rust book and Rust for an example. Additionally, there are some really great videos on YouTube about building libraries in Rust. One of my favorites is building a channel implementation in Rust from scratch.
We’d like to thank Chris for taking the time to do this interview. It was very interesting to see how Rust is used as the primary language for creating CLI tools and how we learn from all of the things we create here and contribute to the Rust community so that others can benefit too. We hope you found this interview useful and that it gave you some insight into how and where Rust is used on Facebook. Look out for other interview blogs where we meet with many more engineers and hear their thoughts on the subject.
About the Meet the Rustaceans range
Rust has been rated as the “most popular” language consistently for the past 5 years. At Facebook, we believe that Rust is a standout language that shines on critical issues like storage security, performance, and reliability and is widely used in a large area of projects here. This blog is part of our Meet the Rustaceans series where we invite the engineers and developers who use Rust regularly to share their experiences and tell us about the amazing products they make with Rust here on Facebook.
To learn more about Facebook Open Source, visit our Open Source website, subscribe to our YouTube channel, or follow us on Twitter and Facebook.
Interested in working with Production Engineering on Facebook? Take a look at our job vacancies on our careers page for production technology.