Should sampled retrieval support pieces up to 1,016 MiB?
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 12/100
- Issue type
- Feature
- Clarity
- Needs clarification
- Activity status
- Active
- Tech stack
- kubernetes, nodejs, typescript
- Domain
- backend, performance
Research direction
This is a decision question, not a ready task: the issue asks whether sampled retrieval should test pieces up to 1,016 MiB. Read the memory and event-loop notes, then the current limits SAMPLED_MAX_BLOCK_DOWNLOAD_BYTES, HTTP2_REQUEST_TIMEOUT_MS, and the Buffer.concat and readBlocks paths the issue names. Done means the expansion decision and its reasoning are recorded in the issue, with follow-up implementation issues opened if yes.
Written by the indexing model from the issue text.
Description
Do we need this?
Sampled retrieval selects pieces up to 100 MiB and aborts downloads over 200 MiB. Should it also test pieces up to 1,016 MiB, the most raw data a 1 GiB piece can hold?
For
- Pieces over 200 MiB are never tested, so an SP could serve small pieces well and large ones badly without us seeing it (see #428).
- For four SPs, these pieces are about half or more of what they store.
Against
- About 92% of pieces are within 200 MiB, and every sampled SP has some.
- It needs a new download path, longer jobs and up to 1 GiB of egress per check.
- Slow SPs may time out: 4 of 10 tested SPs average below the 4.2 MiB/s needed to fetch 1,016 MiB in today's 240s, and 1 of 10 below the 1.7 MiB/s needed in 600s.
Data (mainnet, 2026-11-09)
Random 1/64 sample of active pieces not paid for by dealbot: 8,263 pieces across 19 SPs.
| Size | Pieces | Share |
|---|---|---|
| Up to 200 MiB | 7,642 | 92.5% |
| 200 MiB to 1 GiB | 621 | 7.5% |
| Over 1 GiB | 0 | 0% |
A separate scan of over-200 MiB pieces, stopped at 12,000 rows, found 7 over 1 GiB. The largest was 5,888 MiB.
If yes: what it takes
Raising the limit alone won't work:
- Memory: a piece is held twice during
Buffer.concat, then copied again bynew Uint8Array(pieceBytes)inreadBlocks. A 1,016 MiB piece needs about 2 GiB, which is the worker's memory limit. - Event loop:
Piece.calculateon a whole buffer blocks the event loop. 100 MiB stalled it for 3.5s on a laptop, so 1 GiB would take about 35s, and longer on a 1-CPU pod. The liveness probe allows 3 failures 20s apart.
Proposed approach:
- Download the piece to a file under
/datasets, the 5GiemptyDiralready mounted on the worker. - Compute CommP from a file stream. Streaming cut the longest stall to 15ms for 100 MiB.
- Parse the CAR as a stream, keep a random sample of blocks, and reject blocks over
SAMPLED_MAX_BLOCK_DOWNLOAD_BYTES. The decoder otherwise buffers whatever length the CAR claims. - Add a low-weight bucket for 100 MiB to 1,016 MiB, with at most 2 of these downloads per pod.
PG_BOSS_LOCAL_CONCURRENCYdefaults to 20, which could otherwise fill the volume.
Hashing during the download would avoid the disk, but the two fastest SPs average 48 and 67 MiB/s against about 29 MiB/s for hashing, so it would cap their measured throughput.
| Setting | Now | Proposed |
|---|---|---|
HTTP2_REQUEST_TIMEOUT_MS |
240s | 600s |
MAINNET_SAMPLED_RETRIEVAL_JOB_TIMEOUT_SECONDS |
360s | 720s |
Worker terminationGracePeriodSeconds |
480s | 840s |
Hash speed on a pod and disk write speed still need measuring on staging.
Open questions
- Should a timeout on a large piece count as a retrieval failure?
- What weight should the new bucket have? About 5% would keep added egress and timeouts low.
- Is 1,016 MiB the right upper limit?
Done when
- We've decided whether to expand, and up to what size, with the reasoning recorded here.
- If yes, follow-up work is opened for the implementation and deployment changes.
- Dominant language
- TypeScript
- Stars
- 2
- Forks
- 9
- Avg merge
- 5d 6h
- Merged PRs (30d)
- 9
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from FilOzone/dealbot
-
Difficulty 1/5 Under an hour Newbie friendliness 76/100
FilOzone/dealbot#649 · 2 comments ·
Maintainers usually reply within 1 day
-
enhancement good first issue help wanted ready-for-work
Difficulty 1/5 Under an hour Newbie friendliness 86/100
FilOzone/dealbot#616 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 5/5 Over a week Newbie friendliness 12/100
FilOzone/dealbot#775 · 1 comment ·
Maintainers usually reply within 1 day
-
Find what is causing OOMKilled dealbot workersPossibly taken A pull request linked to this issue is open or already merged. Open
Difficulty 4/5 3-5 days Newbie friendliness 20/100
FilOzone/dealbot#765 · 3 comments ·
Maintainers usually reply within 1 day
-
Difficulty 3/5 Half a day Newbie friendliness 45/100
Maintainers usually reply within 1 day
All issues in FilOzone/dealbot
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
zabuton-app/meguri#875 ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 86/100
iruzen-dono/workless#117 ·
Maintainers usually reply within 1 day
-
area:api area:web wave wave:trivial
Difficulty 2/5 1-3 hours Newbie friendliness 67/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
vetro-protocol/vetro-monorepo#1321 ·
Maintainers usually reply within 1 day