Repository navigation
Conversation
Contributor
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.Scanned FilesNone |
mrgrain
force-pushed
the
mrgrain/feat/npmjs/follower-queues-all-changes
branch
2 times, most recently
from
October 15, 2026 09:20
9d5825a to
bee336f
Compare
The follower now sends every new change entry to the packument queue, and the packument processor fetches and processes each package. The follower no longer talks to the registry, the known versions table, or the stager, and needs much less memory. A change request is processed right away. If the registry is behind or has no packument yet, the processor replaces it with a laggy or missing request, which is re-checked as before. Fetch errors retry the change request with the same growing waits. The follower still re-reads its trailing window, so late entries are still found. Entries may be processed more than once; the known versions table keeps versions from being staged twice.
mrgrain
force-pushed
the
mrgrain/feat/npmjs/follower-queues-all-changes
branch
from
October 16, 2026 08:42
2d2b32b to
1c2580b
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This finishes the split started in #1942. The follower now only reads the changes feed: it sends every new change entry to the packument queue, and the packument processor fetches and processes each package. Until now the follower fetched every packument itself, in large chunks inside a single 5 minute run. That is what made it slow to catch up after an outage, and what made it run out of memory on large backlogs.
The follower still re-reads its trailing window on every run and keeps receipts, so change entries that show up late or out of order are still found. It no longer talks to the registry, the known versions table, the deny and license lists, or the stager. Its role loses those permissions, and its memory goes from 10 GB to 2 GB.
A request is now one message for its whole life. The processor processes whatever the registry serves, and the request is done once the registry serves the announced revision. Until then the same message is checked again with growing waits. After a day, the next failed check gives up on it. That last check decides the reason: the registry served an older revision, had no packument, or could not be reached. This replaces the
laggyandmissingfollow-up requests from #1942, and the processor no longer reads the dead-letter queue. The dead-letter queue only catches requests that keep failing the function. Requests already in the queue are still read.Things to look at
Entries can be processed more than once: a run that dies between sending a chunk and saving its receipts sends the chunk again. That is fine, the known versions table keeps versions from being staged twice.
The processor now reads up to 10 batches of 10 at once, so up to 100 packuments in flight. That is about what the follower did before. We want to limit access to npm, so we don't get throttled.
The packument metrics change:
FailedPackumentRetrievalscounts every check where the registry did not serve the announced revision.PackumentGiveUpscounts give-ups, with aReasondimension (Laggy,Missing,Unreachable) and as a total.PackumentDelayis how long a packument took to show up, in seconds, when earlier checks failed.The old laggy and missing metrics are no longer emitted, and their
metric*()methods are deprecated.NpmJsChangeAge,MetadataFetchFailuresandRelevantPackageVersionsnow come from the processor, in the same namespace.ChangeCount, which theNoChangesalarm uses, still comes from the follower.The
MissingPackumentsHighalarm is replaced byPendingPackumentsHigh, which fires when more than 2,000 requests wait for their next attempt for 3 hours. That counts each package once, however often it was checked. The threshold is a first guess.LaggyPackumentLagHighkeeps its name and now usesPackumentDelay.The known versions migration now also runs before and after the packument processor is updated, not just the follower, because the processor now uses the table.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license