A Little Rust-Y: Using Rust Interop To Boost Performance of Existing Apps (In Any Language)

Rust is known for great performance, but migrating your entire application to Rust is a daunting proposition.


In recent years, Rust interop libraries have blossomed in the open source community: you can now write small Rust functions and call them from your favorite programming language without re-writing your whole app. This opens the door to targeted, incremental migrations of the most performance-sensitive parts of your application, even if you're not a Rust expert!


In this training we will work through a hands-on lab to improve the performance and reduce the costs of an AWS Lambda (written in Node.js) using a tiny bit of Rust code. We will:

  • (Optionally) Deploy a Node.js Lambda that ingests some sample data into a distributed cache, and observe its performance and cost
  • Run the code locally, and use a profiling tool to see which parts of the code are the most expensive
  • Once we’ve identified the code we want to improve, we will switch gears to Rust
  • Go over some “Hello World” basics in Rust
  • Explore an open source library that generates Node.js bindings for our Rust functions
  • Write a Rust function that does some of the work that our Node.js code was doing
  • Learn how to deploy the new Node.js+Rust version of our Lambda
  • Revisit the cost and performance characteristics so that we can quantify the improvements we achieved with just a small amount of Rust code


Come join us and see how you can get real benefits from Rust without going all in, giving up on your favorite languages, or making a huge scary investment!

 

Key Takeaways

1 Rust interop libraries are available in most languages.

2 By profiling your app, you are likely to find a few key spots that are the most expensive.

3 Using a Rust interop library, it is possible to surgically replace expensive parts of your code with Rust - without re-writing your whole app.

4 Replacing the most expensive parts of your app with Rust can have dramatic impacts on your performance.

5 Even minor performance improvements can result in dramatic cost savings, especially in environments like AWS Lambda.


Speaker

Chris Price

Software Engineer @Momento, Previously Launched New Video Streaming Services @AWS, 10+ Years in Engineering Leadership at Software Startups

Chris is a Software Engineer at Momento, where he helped design and build Momento’s cellular architecture and the corresponding CI/CD automation.

His interest in infrastructure automation began at Puppet Labs, during the genesis of the DevOps movement. After 5 years in a tech lead role at Puppet, Chris moved on to AWS, where he helped build the foundation for the brand new AWS MediaTailor service, a core component of Amazon’s NFL Thursday Night Football broadcasts and one of the first services inside of AWS to launch with a cellular architecture on Day 1.

Now at Momento, Chris is passionately working to improve the productivity and happiness of all engineers who have ever experienced the “joys” of building and operating a cache cluster, by contributing to Momento’s serverless caching products. When he escapes from the keyboard, you will most likely find him in the garden or on a bike ride in his beautiful home town of Portland, OR.

Read more
Find Chris Price at:

Speaker

Anita Ruangrotsakun

Software Engineer @Momento

Anita is a software engineer on the Developer Ecosystem team at Momento, working to provide an excellent developer experience and accelerate the building of serverless applications. Prior to Momento, she earned a master's degree at Oregon State University focusing on the intersection of Human-Computer Interaction, Software Engineering, and Machine Learning. Outside of work, you may find her hanging out with her two cats or reading at a cozy cafe.

Read more

Date

Thursday Nov 21 / 01:00PM PST ( 3 hours )

Location

Seacliff D

Level

Level intermediate

Share

Prerequisites

  • Participants will need to have installed Node.js version 18 or later, and corresponding version of npm. (We recommend nodenv if you do not already have Node.js installed.)
  • Participants will need to have the Rust toolchain (including the cargo build tool) installed. (We recommend rustup if you do not already have Rust installed.)
  • In a few sections of the training, we will be doing deploys to AWS lambda to explore performance and costs. Participants who have an AWS account may optionally deploy to their own accounts during these steps; participants who do not wish to deploy to AWS may just follow along with the presenters. If you do wish to deploy to AWS, make sure your AWS credentials are configured and you can successfully run aws cli commands, such as aws s3 ls. (All of our activities should fit into the AWS free tier so there should be no AWS charges incurred.)