Member-only story
Rust in the real world: Write a CLI to perform load testing using Tokio
This article is part of a series of articles (first part and second part) which focuses of writing production grade Rust applications in order to prove that Rust can be used to run production workloads safety.
In this article, we are going to write a CLI that can be used to run load testing of any REST APIs. The goal is to show you how to write CLIs in Rust and also show you how to write concurrent applications using Tokio.
NOTE: This is just an example that you can use as a template to write your own CLI. It is not meant to use as a real load testing tool, there are other tools such K6 that you can use instead. This is just an application that can be used for learning purposes but that uses everything required to write production grade CLIs Rust.
The Source Code for this project can be found here. It is recommended that you check out the project to follow along.
NOTE: This is not a Rust tutorial, it will be too tedious to explain every detail line by line and it will be too boring; that is why I recommend that you check out the code and follow along. I will try to explain how the code works at the general level and provide links to the libraries used, but if you are new to Rust, you may find some concepts difficult, if that’s the case, check the…