You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have looked for existing issues (including closed) about this
Bug Report
Version
axum v0.7.4
axum-core v0.4.3
Platform
Linux [..] 6.7.2-arch1-2 #1 SMP PREEMPT_DYNAMIC Wed, 31 Jan 2024 09:22:15 +0000 x86_64 GNU/Linux
Crates
axum = "0.7.4"
tokio = { version = "1.36.0", features = ["full"] }
Description
simplescreenrecorder-2024-02-07_03.49.11.webm
Greetings, everyone.
While testing axum, I noticed a strange feature: every time I ran wrk, the memory consumption increased. In the video above, each server outputs "Hello, World!". As you can see axum's memory consumption is increasing, while actix-web behaves quite predictably. I also tried adding an asynchronous wait to emulate an I/O operation, but this had no effect on memory consumption. At first I thought it looked like a memory leak, but I didn't jump to conclusions and continued testing. I noticed one detail: axum returns memory, but in my case it happened only after a few hours. I'm afraid that in production the application might crash with an OOM error.
My code:
use axum::{response::Html, routing::get, Router};
#[tokio::main]
async fn main() {
let app = Router::new().route("/", get(handler));
let listener = tokio::net::TcpListener::bind("127.0.0.1:3000")
.await
.unwrap();
println!("listening on {}", listener.local_addr().unwrap());
axum::serve(listener, app).await.unwrap();
}
async fn handler() -> Html<&'static str> {
// optional
tokio::time::sleep(std::time::Duration::from_millis(50)).await;
Html("<h1>Hello, World!</h1>")
}
Please let me know if I have made any errors in the design of the Bug Report.
The text was updated successfully, but these errors were encountered:
Bug Report
Version
axum v0.7.4
axum-core v0.4.3
Platform
Linux [..] 6.7.2-arch1-2 #1 SMP PREEMPT_DYNAMIC Wed, 31 Jan 2024 09:22:15 +0000 x86_64 GNU/Linux
Crates
axum = "0.7.4"
tokio = { version = "1.36.0", features = ["full"] }
Description
simplescreenrecorder-2024-02-07_03.49.11.webm
Greetings, everyone.
While testing
axum
, I noticed a strange feature: every time I ranwrk
, the memory consumption increased. In the video above, each server outputs "Hello, World!". As you can seeaxum's
memory consumption is increasing, whileactix-web
behaves quite predictably. I also tried adding an asynchronous wait to emulate an I/O operation, but this had no effect on memory consumption. At first I thought it looked like a memory leak, but I didn't jump to conclusions and continued testing. I noticed one detail:axum
returns memory, but in my case it happened only after a few hours. I'm afraid that in production the application might crash with an OOM error.My code:
Please let me know if I have made any errors in the design of the Bug Report.
The text was updated successfully, but these errors were encountered: