actix / actix-web

Actix Web is a powerful, pragmatic, and extremely fast web framework for Rust.
https://actix.rs
Apache License 2.0
20.73k stars 1.63k forks source link

Idle cpu consumption #3411

Open belovaf opened 1 week ago

belovaf commented 1 week ago

Expected Behavior

Actix doesn't consume cpu while idle.

Current Behavior

Actix constantly consumes 0.1% cpu while idle.

Steps to Reproduce (for bugs)

Start hello world actix server.

Context

I have tested other web frameworks: axum, ntex. They don't consume any cpu while idle as expected.

Your Environment

belovaf commented 1 week ago

It looks like actix-web contains a busy-loop. My system monitor shows that an actix process constantly increases the number of "Idle Wake Ups": Number of times a thread caused the system to wake up from idleness to begin executing the thread.

belovaf commented 1 week ago

I tried to debug and I see that actix-server worker threads are busy-looping. Worker threads are constantly parked / unparked.

image
belovaf commented 1 week ago

Also the process system call counter is constantly increasing while idle.