Skip to content

Fetch registry files with more concurrency than tarballs - #1257

Merged
ericmj merged 1 commit into
mainfrom
ericmj/registry-fetch-concurrency
Oct 6, 2026
Merged

ericmj merged 1 commit into
mainfrom
ericmj/registry-fetch-concurrency

Conversation

@ericmj

@ericmj ericmj commented Oct 6, 2026 •

Copy link
Copy Markdown
Member

Registry, policy and tarball fetches shared one Hex.Parallel limited to http_concurrency, 8 by default. Registry and policy files average a few kilobytes, so their fetch time is mostly round trips, while tarballs can be up to 16 MB and are held in memory while they're fetched.

Registry and policy files now go through their own Hex.Parallel with four times http_concurrency, 32 by default. Tarballs keep http_concurrency, so setting HEX_HTTP_CONCURRENCY=1 on a slow network still fetches one tarball at a time.

mix deps.get for the 100 Hex packages in hexpm's mix.lock went from 2.68 s to 2.40 s, the median of 15 interleaved runs with an empty Hex cache and no deps directory, on macOS against repo.hex.pm on 2026-10-06. It was faster in 14 of 15 pairs. On top of #1256 it went from 2.16 s to 2.04 s, faster in 14 of 15 pairs.

This conflicts with #1260 in lib/hex/scm.ex, whichever merges second needs a rebase.

Registry, policy and tarball fetches shared one Hex.Parallel limited to
http_concurrency, 8 by default. Registry and policy files average a few
kilobytes, so their fetch time is mostly round trips, while tarballs
can be up to 16 MB and are held in memory while they're fetched.

Registry and policy files now go through their own Hex.Parallel with
four times http_concurrency, 32 by default. Tarballs keep
http_concurrency, so setting HEX_HTTP_CONCURRENCY=1 on a slow network
still fetches one tarball at a time.

mix deps.get for a project with the 100 Hex packages in hexpm's
mix.lock went from 2.68 s to 2.40 s, the median of 15 interleaved runs
with an empty Hex cache and no deps directory, on macOS against
repo.hex.pm.
@ericmj
ericmj marked this pull request as ready for review October 6, 2026 10:21
@ericmj
ericmj merged commit 7282bdb into main Oct 6, 2026
22 checks passed
@ericmj
ericmj deleted the ericmj/registry-fetch-concurrency branch October 6, 2026 10:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant