Quarkus (Java) vs Actix (Rust): Hello world performance

Mayank C
Tech Tonic

--

In the following article, we will delve into the performance analysis of two widely used frameworks: Quarkus & Java with Actix & Rust. It’s important to note that this comparison focuses specifically on the frameworks and not the underlying programming languages.

Actix Web is a powerful, pragmatic, and extremely fast web framework for Rust. Quarkus was created to enable Java developers to create applications for a modern, cloud-native world. Quarkus is a Kubernetes-native Java framework tailored for GraalVM and HotSpot, crafted from best-of-breed Java libraries and standards.

Setup

All tests are executed on MacBook Pro M2 with 16G RAM. For load testing, we’ve used Bombardier test tool. The software versions are:

  • Quarkus 3.5.1 with Java v21
  • Actix 4.4.0 with Rust 1.73.0

The application code is as simple as:

Quarkus (Java)

package org.acme;

import jakarta.ws.rs.GET;
import jakarta.ws.rs.Path;
import jakarta.ws.rs.Produces;
import jakarta.ws.rs.core.MediaType;
import io.smallrye.common.annotation.NonBlocking;

@Path("/")
public class HelloWorldApplication {

@GET
@NonBlocking
@Produces(MediaType.TEXT_PLAIN)
public String hello() {
return "Hello World!";
}
}

Actix (Rust)

use actix_web::{get, App, HttpServer, Responder};

#[get("/")]
async fn index() -> impl Responder {
"Hello World!"
}

#[actix_web::main]
async fn main() -> std::io::Result<()> {
HttpServer::new(|| App::new().service(index))
.bind(("127.0.0.1", 3000))?
.run()
.await
}

The rust application has been built in release mode.

Results

All tests are executed for 10 million requests using 50, 100, and 300 concurrent connections. The results in chart and tabular form are as follows:

Conclusion

When it comes to speed, Quarkus outpaces Rust, which may be surprising given that the Java Virtual Machine (JVM) demonstrates faster performance compared to machine code. In terms of resource utilization, both exhibit similar CPU usage. Nevertheless, it’s noteworthy that the memory consumption of Quarkus is significantly higher than that of Rust.

Thanks for reading this article!

--

--