Language Wars: Rust vs Node.js vs C#

Language Wars: Rust vs Node.js vs C#

In previous articles, I have demonstrated how to build API in RustNode.js, and C#. Today it’s time to run it side by side and check what is the speed of each implementation. Let’s the language wars begin!

Testing methodology

I will be using our User API, that we have created in previous articles.

For this test I will be using the wrk command-line app with the following parameters:

wrk -t 12 -c 400 -d 1m

I’m using 12 threads and 400 connections to API. Each test is 1 minute.

I’m running it from macOS 10.15.4 and my laptop parameters are:

  • MacBook Pro 2016
  • 3,3 GHz Dual-Core Intel Core i7
  • 16 GB 2133 MHz LPDDR3

There are 5 runs of each test and I’m taking the median as a result.

Each application was set to production mode.

Testing without database.

This test will show us the maximum speed for API on my laptop. We don’t need to worry about the local database speed.

As you can see, from the above results, Rust is miles away in terms of raw performance comparing to the other two languages. It reached almost 70 000 req/s which is impressive.

Testing with database.

This time, I have connected each API with the local MySQL database running in the Docker. After testing those are results:

Once again Rust is in the first place but results are very different from the first test. It seems that my local database connections are quite slow and I would need to get into an enterprise-level system to check it out one more time.

In the next articles, I will deploy all three solutions to AWS lambdas, where more tests can be done. I will test each API speed for the cold and warm start. To access data, I will use a new AWS RDS proxy for the RDS serverless database. This will make a truly serverless solution. 

With the above results in hand, I’m impressed with Rust and I hope it will gain more tractions as it’s fun to write code in it, and as you can see it is fast and has a low memory footprint. (Sneak peek, my lambda functions with 128MB allocated memory use around 40MB for simple functions, with the size of around 3 MB for deployment file.)

Previous articles:

If you have an interesting project or need a highly qualified team, take a look at to learn more about our company and get in touch.

Leave a Reply

Your email address will not be published. Required fields are marked *