uv
783df8f6 - Consolidate concurrency limits (#3493)

Commit
1 year ago
Consolidate concurrency limits (#3493) ## Summary This PR consolidates the concurrency limits used throughout `uv` and exposes two limits, `UV_CONCURRENT_DOWNLOADS` and `UV_CONCURRENT_BUILDS`, as environment variables. Currently, `uv` has a number of concurrent streams that it buffers using relatively arbitrary limits for backpressure. However, many of these limits are conflated. We run a relatively small number of tasks overall and should start most things as soon as possible. What we really want to limit are three separate operations: - File I/O. This is managed by tokio's blocking pool and we should not really have to worry about it. - Network I/O. - Python build processes. Because the current limits span a broad range of tasks, it's possible that a limit meant for network I/O is occupied by tasks performing builds, reading from the file system, or even waiting on a `OnceMap`. We also don't limit build processes that end up being required to perform a download. While this may not pose a performance problem because our limits are relatively high, it does mean that the limits do not do what we want, making it tricky to expose them to users (https://github.com/astral-sh/uv/issues/1205, https://github.com/astral-sh/uv/issues/3311). After this change, the limits on network I/O and build processes are centralized and managed by semaphores. All other tasks are unbuffered (note that these tasks are still bounded, so backpressure should not be a problem).
Author
Parents
  • File
    Cargo.lock
  • File
    README.md
  • crates
    • bench
      • File
        Cargo.toml
      • benches
        • File
          uv.rs
    • uv-build/src
      • File
        lib.rs
    • uv-configuration/src
      • File
        concurrency.rs
      • File
        lib.rs
    • uv-dev
      • File
        Cargo.toml
      • src
        • File
          build.rs
        • File
          resolve_cli.rs
        • File
          resolve_many.rs
    • uv-dispatch
      • File
        Cargo.toml
      • src
        • File
          lib.rs
    • uv-distribution/src
      • File
        distribution_database.rs
      • source
        • File
          mod.rs
    • uv-installer/src
      • File
        downloader.rs
    • uv-requirements/src
      • File
        lookahead.rs
      • File
        source_tree.rs
      • File
        unnamed.rs
    • uv-resolver
      • src/resolver
        • File
          mod.rs
        • File
          provider.rs
      • tests
        • File
          resolver.rs
    • uv-workspace/src
      • File
        combine.rs
      • File
        settings.rs
    • uv/src
      • commands
        • File
          pip_compile.rs
        • File
          pip_install.rs
        • File
          pip_sync.rs
        • project
          • File
            lock.rs
          • File
            mod.rs
          • File
            run.rs
          • File
            sync.rs
        • File
          venv.rs
      • File
        main.rs
      • File
        settings.rs
  • File
    uv.schema.json