Skip to content

Conversation

@anacrolix
Copy link
Contributor

@anacrolix anacrolix commented Nov 4, 2025

#16699.

The changes are primarily in anacrolix/torrent, https://github.com/anacrolix/torrent/compare/d922d78d2e6135477b120daae537bf79a675d2c6..client-trackers.

Instead of firing off announces whenever we can, and maintaining a goroutine for every tracker and torrent combination, there's a dispatcher that reuses tracker announce clients, limits parallelism, and prioritizes announces to torrents that need them most, including doing things like avoiding announcing the same torrent to different trackers simultaneously unless there's nothing else to do, sending stop and completion events even when torrents are dropped, and avoiding announcing for torrents that have active webseed requests.

The impact for Erigon is that peers become available much sooner to the torrents that need them. Subjectively it goes from taking 5 mins or more to ~5-10s to start downloading from peers. There's also a possible issue around webseeds stalling if peers weren't present to tickle certain states that was fixed. I also added a hard webseed request stall fix after encountering it more often now that peers were more active on non-webseeding torrents.

There's a few optimizations that might be available down the road. The new indexing uses values instead of references in a lot of places, a careful strategy but probably results in a lot more cache and memory use than really necessary. It shouldn't show up in profiling as very large, but if it does there's plenty of easy stuff to improve once the concept has proven itself.

There's also a bunch of logging fixes in varous places. I expect to see a panic or two for edge cases I missed. There was a nagging one around some state not being propagated correctly but I think I've resolved that now.

@anacrolix anacrolix force-pushed the anacrolix/client-trackers branch 6 times, most recently from 4bd60ee to b344b90 Compare November 11, 2025 06:12
@anacrolix anacrolix force-pushed the anacrolix/client-trackers branch from b344b90 to e82c2ee Compare November 12, 2025 04:10
@anacrolix anacrolix marked this pull request as ready for review November 12, 2025 04:41
@anacrolix
Copy link
Contributor Author

This should be ready. I want to make sure sync from scratch CI works now. I think it's only failed for unrelated reasons so far.

@anacrolix
Copy link
Contributor Author

The test failure is unrelated.

@anacrolix anacrolix changed the title DRAFT for CI: Client-level trackers Client-level trackers Nov 13, 2025
@anacrolix anacrolix requested a review from mh0lt November 13, 2025 00:44
@anacrolix
Copy link
Contributor Author

@AskAlexSharov
Copy link
Collaborator

    --- FAIL: TestSetupGenesis/custom_block_in_DB,_genesis_==_sepolia (0.54s)
panic: fail to open mdbx: mdbx_env_open: The paging file is too small for this operation to complete., label: temporary, trace: [kv_mdbx.go:310 kv_mdbx.go:424 genesis_write.go:312 genesis_write.go:222 genesis_write.go:259 genesis_write.go:245 genesis_test.go:247 genesis_test.go:305 testing.go:1792 asm_amd64.s:1700] [recovered]
	panic: fail to open mdbx: mdbx_env_open: The paging file is too small for this operation to complete., label: temporary, trace: [kv_mdbx.go:310 kv_mdbx.go:424 genesis_write.go:312 genesis_write.go:222 genesis_write.go:259 genesis_write.go:245 genesis_test.go:247 genesis_test.go:305 testing.go:1792 asm_amd64.s:1700]

currentely we have:

        uses: al-cheb/[email protected]
        with:
          minimum-size: 8GB

@AskAlexSharov
Copy link
Collaborator

pushed fix for win. TestSetupGenesis taking 0.34sec - don't need more parallelism there.

@AskAlexSharov AskAlexSharov merged commit 77dcc03 into main Nov 14, 2025
19 checks passed
@AskAlexSharov AskAlexSharov deleted the anacrolix/client-trackers branch November 14, 2025 03:21
@AskAlexSharov AskAlexSharov added this to the 3.3.0 milestone Nov 17, 2025
@AskAlexSharov AskAlexSharov changed the title Client-level trackers Reduce goroutines amount: Client-level trackers Nov 17, 2025
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.

4 participants