Skip to content

stability/performance: better tuning of concurrent downloads/installs #10570

@morotti

Description

@morotti

Hello,

I've having another play with uv. I've noticed some suboptimal settings that make it unstable at times.

download: the default is 50 concurrent downloads https://docs.astral.sh/uv/reference/settings/#concurrent-downloads
it's too much. it's getting connection errors at times, when going to internal mirrors.
it probably drops too for people who have broadband with only a few Mbps or kbps.
people reported the issue before and added retries, though the root is likely to be making too many concurrent requests. #3514

Can I suggest to reduce the download concurrency to 20 by default?
It should address issues with timeouts/disconnections.
It doesn't reduce performance, it's a percent or two faster in my experience.
(I note that 20 is still a high value, users might get disconnections for example if they run against a pypi mirror with limited CPU).

As a nice side effect, shells are around 80 characters * 24 lines by default. You can now see all the 20 lines of output :D

install: the default is number of cores. https://docs.astral.sh/uv/reference/settings/#concurrent-installs
this is not a safe value since the average computer now has 128 or 256 cores (well, the average server 😉 )

Optimal settings will vary depending on the type of storage and block size. It's more difficult to optimize but 100+ is vastly counterproductive on all types of devices.
I believe uv has small block sizes and most python files are 1-100 kB. With small I/O like that, you have to make dozens of concurrent operation to utilize the hardware effectively.
Can I suggest to cap concurrent installs to min(cpu_count, 32) as a safe and optimal value for most storage?

I see a couple percent faster installation and 10% less sys time (kernel time) with that on my 128 cores machine.

Cheers.

Metadata

Metadata

Assignees

No one assigned

    Labels

    performancePotential performance improvement

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions