I am fairly new to Rust and just started creating some Rust actix-web apps to compare with the Java Spring Boot app. My test is a CRUD operation against a Cassandra database.
At the moment, I am testing both apps locally on my Macbook Pro. For Spring boot app, it runs with the command "Java -jar the-java-app.jar". It can take 1000+ virtual users with no problem.
For the Rust app, I found something which is only unique to Rust. if I use cargo run to start the application, it works as expected, It will take 1000+ virtual users, and the performance is slightly better than Spring Boot, which is expected.
However, if I directly run the executable under the target/release folder to start the app, then the Rust app only can take about 200 virtual users. If I add more load, it'll start throwing the "connection reset by peer" error. I tried "cargo build --release" and with or without "--target x86_64-apple-darwin", the result is the same.
The reason this is a concern is that when I deploy the Rust app, I will start the Rust app with just the executable as many online posts suggested. A sample dockerfile is as the following:
FROM rust:1.63.0 as builder WORKDIR /app ... RUN cargo build --release --target x86_64-unknown-linux-gnu FROM debian:bullseye-slim COPY --from=builder /app/.../release/rustapp /usr/local/bin/rustapp CMD ["rustapp"]
So, I have a few questions,
Will this container also have the limitation that I have observed from my local laptop? Is this a concern for running this in a container on Kubernetes? if so, what is the configuration to fix the issue?
Am I missing something on my local settings to run Rust standalone app? Is there a way to let the Rust app utilize more resources to support more loads like "cargo run" can do?