Skip to content

provider: buffer pin providers - #10746

Merged
hsanjuan merged 3 commits into
masterfrom
fix/10596-buffered-reprovides
Mar 10, 2025
Merged

hsanjuan merged 3 commits into
masterfrom
fix/10596-buffered-reprovides

Conversation

@hsanjuan

@hsanjuan hsanjuan commented Mar 6, 2025

Copy link
Copy Markdown
Contributor

Fixes #10596.

The reproviding process can take long. Currently, each CID to be provided is
obtained by making a query to the pinner and reading one by one as the CIDs
get provided.

While this query is ongoing, the pinner holds a Read mutex on the pinset.

If a pin-add-request arrives, a goroutine will start waiting for a Write mutex
on the pinset. From that point, no new Read mutexes can be taken until the writer
can proceed and finishes.

However, no one can proceed because the read mutex is still held while the
reproviding is ongoing.

The fix is mostly in Boxo, where we add a "buffered" provider which reads the
cids onto memory so that they can be provided at its own pace without making
everyone wait.

The consequence is we will need more RAM memory. Rule of thumb is 1GiB extra per 20M cids to be reprovided.

@hsanjuan
hsanjuan requested a review from a team as a code owner March 6, 2025 14:35
hsanjuan added 2 commits March 7, 2025 08:43
Fixes #10596.

The reproviding process can take long. Currently, each CID to be provided is
obtained by making a query to the pinner and reading one by one as the CIDs
get provided.

While this query is ongoing, the pinner holds a Read mutex on the pinset.

If a pin-add-request arrives, a goroutine will start waiting for a Write mutex
on the pinset. From that point, no new Read mutexes can be taken until the writer
can proceed and finishes.

However, no one can proceed because the read mutex is still held while the
reproviding is ongoing.

The fix is mostly in Boxo, where we add a "buffered" provider which reads the
cids onto memory so that they can be provided at its own pace without making
everyone wait.

The consequence is we will need more RAM memory. Rule of thumb is 1GiB extra per 20M cids to be reprovided.
@hsanjuan
hsanjuan force-pushed the fix/10596-buffered-reprovides branch from 82b8596 to ba22102 Compare March 7, 2025 07:43
@hsanjuan

hsanjuan commented Mar 7, 2025

Copy link
Copy Markdown
Contributor Author

This now depends on boxo/main and is RTM once reviewed.

@hsanjuan hsanjuan mentioned this pull request Mar 7, 2025
3 tasks done
Comment thread docs/changelogs/v0.34.md Resolved
@hsanjuan
hsanjuan merged commit 4260607 into master Mar 10, 2025
@hsanjuan
hsanjuan deleted the fix/10596-buffered-reprovides branch March 10, 2025 14:16
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.

Kubo stopped listing pin after some times

2 participants