Skip to content

why pool_max_idle_per_host(0) can solve cpu usage #2767

@chenqimiao

Description

@chenqimiao
let download_client = reqwest::Client::builder()
    .user_agent(UA)
    .default_headers(headers)
    // OSS closes idle connections after 0 seconds,
    .pool_idle_timeout(Duration::from_secs(0))
    .pool_max_idle_per_host(0)
    .connect_timeout(Duration::from_secs(10))
    .timeout(Duration::from_secs(60))
    .build()?;

I'm encountering an issue with the pool_max_idle_per_host(0) parameter. I understand this controls connection closure behavior.

##Problem: When I omit this line, high-intensity usage of download_client results in sustained high CPU usage even after all requests complete.

My investigation:

I suspected lingering TCP connections might be the cause, but when I checked using:
sudo lsof -nP -iTCP -sTCP:ESTABLISHED | grep 'quarkdr'
I observed that all TCP processes were actually released.

Question:

If TCP connections are confirmed released, what else could be causing the persistent CPU usage?

Looking forward to your answer, Thanks !

Metadata

Metadata

Assignees

No one assigned

    Labels

    B-upstreamBlocked: upstream. Depends on a dependency to make a change first.C-bugCategory: bug. Something is wrong. This is bad!

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions