Commit Graph

588 Commits

Author SHA1 Message Date
Matt Joiner cc0d223a65 Apply download rate limiter to webseeds 2021-12-23 14:00:00 +11:00
Matt Joiner 80aec73cb5 Make Torrent.cancelRequestsForPiece more efficient 2021-12-23 14:00:00 +11:00
Matt Joiner 506ff8d037 Use relative availabilities to determine piece request order
Most overhead comes from peers that connect that have everything, and we just increment every single piece's availability. There may be some unresolved determinism with torrents that share the same ordering.
2021-12-23 14:00:00 +11:00
Matt Joiner 74c70d852a Add TestHaveAllThenBitfield
The result of a misguided attempt to reduce piece peer availability increment and decrement overhead for have all/full-bitfield and conn closes.
2021-12-23 14:00:00 +11:00
Matt Joiner ffb98097fa Fix BenchmarkUpdatePiecePriorities 2021-12-16 14:00:19 +11:00
Matt Joiner 98f188dcbe Update requests after deleting all in some corner cases
Choked by non-fast PeerConn, deleted PeerConn. They're not exactly guarded as strictly as they could be, so there's plenty of room for performance improvements here.
2021-12-13 12:09:12 +11:00
Matt Joiner a671c06b94 Update peer requests if not interested when piece priorities change
This should fix a starvation issue where we don't signal interest to a peer that has us choked.
2021-12-13 11:55:47 +11:00
Matt Joiner 04beb8937f More consistent cancellation management 2021-12-12 18:35:02 +11:00
Matt Joiner 1bc84e316f Don't group Torrent piece request orders without a storage capacity together 2021-12-12 18:35:02 +11:00
Matt Joiner ddf41fc2f1 Add Torrent-level request cancel for consistency 2021-12-12 18:35:01 +11:00
Matt Joiner 117ae28b38 Try request stealing 2021-12-12 18:35:01 +11:00
Matt Joiner 99a64bcf63 Wait between duplicate requests 2021-12-12 18:35:01 +11:00
Matt Joiner 94bb5d40ba Implement piece request ordering with retained state 2021-12-12 18:35:01 +11:00
Matt Joiner ba592028e5 Filter update requests on piece priority change by peer choking and allowed fast 2021-12-12 15:01:50 +11:00
Matt Joiner a2c50ea2bd Handle 503 returns from webseed peer endpoints 2021-12-06 15:24:28 +11:00
Matt Joiner 0f495ce97d Optimize the use of worstConnSlice again 2021-11-29 10:07:48 +11:00
Matt Joiner 4f3db19ca3 Optimize Torrent.haveAnyPieces 2021-11-29 00:44:24 +11:00
Matt Joiner 97e1e2469b Announce to DHT if we want conns, not just peers 2021-11-28 22:46:45 +11:00
Matt Joiner b196fe7765 Wanting peers is a subset of wanting conns 2021-11-28 22:40:55 +11:00
Matt Joiner f621f0f5a8 Don't want conns for seeding unless we have a piece 2021-11-28 22:40:53 +11:00
Matt Joiner 560b463983 Comment out pending requests tests and asserts
These need to be updated. BSI for pending requests removes an enormous amount of memory use for very large torrents.
2021-11-25 22:59:20 +11:00
Matt Joiner 0f81e0011f Avoid calling net.Conn methods with the Client mutex locked
The utp firewall callback might want to use it. I can't think of a better way to determine with an incoming connection request should be blocked.
2021-11-17 14:00:50 +11:00
Matt Joiner a90ae5aed4 Pass HTTP Proxy config into webseeding HTTP client 2021-11-12 14:16:14 +11:00
Matt Joiner dea0e41e29 Boost webseed max requests 2021-11-12 13:51:58 +11:00
Matt Joiner 2fd928b918 Don't use non-directory webseed URLs for multi-file torrents 2021-11-12 12:37:40 +11:00
Matt Joiner c6ee03f449 gofumpt 2021-11-08 14:47:01 +11:00
Matt Joiner 8d193edb7e Remove unused Torrent.numActivePeers 2021-11-01 11:49:36 +11:00
Matt Joiner 87a67db680 Remove unused conn piece inclinations 2021-11-01 11:49:27 +11:00
afjoseph 487352fa5b fixup! [trackerscraper] Add custom DNS lookup function 2021-11-01 11:26:58 +11:00
afjoseph 2a6152b832 [trackerscraper] Add custom DNS lookup function 2021-11-01 11:26:58 +11:00
Matt Joiner 98957b6e8e Only assert pending requests when check is enabled
Uses too much CPU for production from its current callsites.
2021-10-26 14:42:42 +11:00
Matt Joiner 37373864e4 Add more comprehensive pending requests assertions 2021-10-25 16:16:56 +11:00
Matt Joiner d331419604 Demote Torrent.runHandshookConnLoggingErr level to debug 2021-10-21 11:40:06 +11:00
Matt Joiner ff3c186396 Add low requests check
This is an optimization for webseeds, which have 10 synchronous request routines, and if the request count dips below 10, some sit idle. There is probably something similar to be done with PeerConns, which won't update until there are zero requests, but there there is a timer to refresh updates, and the queues are very long (typically 512-2048).
2021-10-21 10:48:43 +11:00
Matt Joiner 8eec0b665e Update webseeds for peer requesting 2021-10-21 10:28:57 +11:00
Matt Joiner a7d3296003 Use roaring.Bitmap.IsEmpty where appropriate 2021-10-19 14:08:56 +11:00
Matt Joiner de87fd3eb1 Avoid allocation putting undirtiedChunksIter into interface 2021-10-19 14:08:56 +11:00
Matt Joiner 529aaa9b1f Use roaring bitmap for pending pieces
Also makes a significant optimization for peerHasWantedPieces possible.
2021-10-19 14:08:56 +11:00
Matt Joiner 5e8f61abb5 Optimize request updates due to conn and reader state changes 2021-10-19 14:08:56 +11:00
Matt Joiner 7d0be0ac65 Optimize chunk calculations in request strategy 2021-10-19 14:08:56 +11:00
Matt Joiner 10b9e88356 Implement pending requests using BSI 2021-10-19 14:08:56 +11:00
Matt Joiner 9aff9f3592 Extract pendingRequests 2021-10-19 14:08:56 +11:00
Matt Joiner 2be5a95b06 Add reasons for updateRequests to be triggered 2021-10-19 14:08:56 +11:00
Matt Joiner 16c571b58b Add pprof labels for request updates and remove Client-wide requester 2021-10-19 14:08:13 +11:00
Matt Joiner 30b99e7102 Remove peer piece inclination and piece request order
These are vestigial data structures used with old request strategy implementations.
2021-10-19 14:08:13 +11:00
Matt Joiner 3ef8cfba27 Log handshook conn run errors with level warning
(cherry picked from commit 7ca7890e9f30307a1f4942e6d987791a142c3cb3)
2021-10-19 14:07:48 +11:00
Matt Joiner 6f196c8d33 Update piece priority after processing piece hash result
Seems to avoid some silly performance issues in triggering request updates due to a piece still pending while being marked.
2021-10-19 14:03:03 +11:00
Simon Kirsten 637045c19a
Add DisableInitialPieceCheck option (#677) 2021-10-11 11:33:40 +11:00
Matt Joiner 72a06d88fc Add TorrentStats.PiecesComplete
Fixes https://github.com/anacrolix/torrent/issues/352.
2021-10-07 13:50:13 +11:00
Matt Joiner 28e9064288 Fix comment that seems to mess with GoLand's package structure 2021-10-07 12:09:52 +11:00