Back to News for Developers

Meet the Rustaceans: Chris Konstad

April 22, 2021ByNavyata Bawa

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.

In what capacity have you been using Rust?

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.

Why did you/your team at Facebook choose to use Rust over other languages?

We chose Rust because of the great variety of libraries and features that make writing complex CLIs a breeze:

  • Structopt is awesome for CLI argument parsing, and it can be used to generate detailed --help messages
  • Indicatif is awesome for helping people know how far along their job is
  • the async/await syntax makes writing async code (which is most of this CLI) very smooth

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.

What are some of the projects that you’ve worked on at Facebook that use Rust?

  • My team's CLI tooling
  • I briefly worked on a project that used Rust in the server provisioning process during a Hackamonth at Facebook
  • I've volunteered my time to work on miscellaneous Rust shared libraries

How do you feel about Rust's growth trajectory at Facebook?

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.

What value does Facebook add to Rust?

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++.

How do you think Rust is growing as a language in 2021?

  • cxx support leads to easier/trivial bindings to C++ code, which means it's much easier to partially adopt Rust code
  • It seems like more and more people are working on Rust professionally, which will be great for the ecosystem. I believe that those resources are the inflection point for Rust's adoption.

Some people who have used Rust have come to really like it, why do you think that is and what is your favorite feature about Rust?

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.

  • compile time guarantees (Option, Result, borrowck)
  • macros, which lead to some awesome libraries (cxx, Structopt)
  • iterator API
  • match
  • .await is really nice for chaining

Where can people learn more about Rust and how can they start contributing to it?

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.

About the Meet the Rustaceans series

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.

To learn more about Facebook Open Source, visit our open source site, subscribe to our YouTube channel, or follow us on Twitter and Facebook.

Interested in working with Production Engineering at Facebook? Check out our job postings on our Production Engineering career page here.