Peer Selection Algorithm #874
Replies: 6 comments 15 replies
-
The core of the algorithm you can follow from these 2 lines: Lines 241 to 242 in 87f6cdc |
Beta Was this translation helpful? Give feedback.
-
This decides the order of requesting pieces which will be scanned later: Line 186 in e10ffd1 For each piece to scan, this appends the indexes of the chunks which belong to the piece to Line 215 in e10ffd1
Line 255 in e10ffd1 My question is even if we have requested a chunk from peer A but haven't received it yet, as the operations above don't modify the result Line 186 in e10ffd1 I would like to know how you schedule multiple(maybe four recommended by BitTorrent) peerConns and whether the condition mentioned in my question exists. |
Beta Was this translation helpful? Give feedback.
-
@anacrolix hello, there is a case, one seeder node and 10 other nodes p2p download from the seeder at the same time. How 10 nodes random pick piece to download? We use 1.15 version and every node download the piece at the same order, so they can not upload data to each other, and only download from the only seeder. If they download different piece, they can upload data to each other and speed up download. |
Beta Was this translation helpful? Give feedback.
-
@luodw Hey, where is the randomized piece order? Can you provide where the code is? |
Beta Was this translation helpful? Give feedback.
-
@anacrolix I use one seeder and three leechers in the LAN. For pieces with the same rarity level, I just order them according to the index. Part of the log is: [2023-11-21 17:03:07 +0800 DBG] "1_1.pkl": 192.168.124.106:42069 piece bitmap: [215], request indexes: [215] [torrent 41c3e8d64158c7e60c4c4b69497ae8fc13a973ef github.com/anacrolix/torrent requesting.go:286]
[2023-11-21 17:03:07 +0800 DBG] "1_1.pkl": 192.168.124.105:42069 piece bitmap: [8 93 97 215 250 291 292 473], request piece indexes: [291 292 250 93 8 97 473 215] [torrent 41c3e8d64158c7e60c4c4b69497ae8fc13a973ef github.com/anacrolix/torrent requesting.go:286] |
Beta Was this translation helpful? Give feedback.
-
I'll close this discussion as it's getting quite scattered. Feel free to open new discussions about any specific point! |
Beta Was this translation helpful? Give feedback.
-
Let's assume such a scenario: Peer A could get piece P from multiple peers. Which peer would A select at last? And what strategy is this selection based on? Does this project provide any detailed algorithm? If it doesn't and I would like to provide such peer selection algorithms, where should I put my code in this project?
Beta Was this translation helpful? Give feedback.
All reactions