Skip to content

Drop the Composer 1 default branch fallback from download tracking - #1841

Merged
Seldaek merged 1 commit into
mainfrom
perf/drop-composer1-download-fallback
Sep 7, 2026
Merged

Drop the Composer 1 default branch fallback from download tracking#1841
Seldaek merged 1 commit into
mainfrom
perf/drop-composer1-download-fallback

Conversation

@Seldaek

@Seldaek Seldaek commented Sep 7, 2026

Copy link
Copy Markdown
Member

trackDownloadsAction resolved Composer 1's 9999999-dev default branch with a SELECT against package + package_versionper package, inside the per-package loop, on an endpoint taking ~2M requests per APM period.

It was the only synchronous MySQL left there (everything else resolves ids through a single Lua call against Redis, and the write is a single EVALSHA), and with PDO::ATTR_TIMEOUT at 1.3s it's the most likely explanation for the endpoint's 10.6s tail.

Support for Composer 1 was shut down on 2025-09-01, which packages.json has been announcing via its warning field since.

Important

This is a behaviour change, not a pure removal. The few remaining Composer 1 clients that hit this path now get a partial response and their downloads stop being counted, instead of being resolved via the package's default branch. Given you said a few requests do still land here, that's your call — happy to close this one if you'd rather keep the resolution and instead seed a 9999999-dev alias into the Redis ids: hash, which would keep the behaviour with no MySQL.

Verification

composer phpstan clean, full suite green. The endpoint had no test coverage at all, so this adds the two cases that matter: a resolvable version is counted (201 success), and an unresolvable one is reported back (200 partial).

trackDownloadsAction resolved Composer 1's 9999999-dev default branch with a SELECT
against package + package_version, per package, inside the per-package loop, on an
endpoint that takes ~2M requests per APM period. It was the only synchronous MySQL left
there - everything else resolves ids through a single Lua call against Redis - and with
a 1.3s PDO connect timeout it is the most likely explanation for the endpoint's 10s tail.

Support for Composer 1 was shut down on 2025-09-01, which packages.json has been
announcing since. Note this is a behaviour change rather than pure removal: the few
remaining Composer 1 clients hitting this path now get a 'partial' response and their
downloads stop being counted, instead of being resolved via the default branch.

The endpoint had no test coverage at all, so this also adds the two cases that matter:
a resolvable version is counted, and an unresolvable one is reported back to the client.
@Seldaek

Seldaek commented Sep 7, 2026

Copy link
Copy Markdown
Member Author

I think this is an acceptable loss, composer 1 client are not so many anymore and this only affects stats for the default branch so 🤷🏻‍♂️

@Seldaek
Seldaek merged commit f7fca39 into main Sep 7, 2026
8 checks passed
@Seldaek
Seldaek deleted the perf/drop-composer1-download-fallback branch September 7, 2026 14:55
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