From: Matt Joiner Date: Fri, 12 Nov 2021 02:51:58 +0000 (+1100) Subject: Boost webseed max requests X-Git-Tag: v1.37.0~5 X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=dea0e41e2908772ca012637e8a4bd0f820ebef11;p=btrtrc.git Boost webseed max requests --- diff --git a/torrent.go b/torrent.go index 80ad8e4b..b9ecb0f6 100644 --- a/torrent.go +++ b/torrent.go @@ -2193,15 +2193,21 @@ func (t *Torrent) addWebSeed(url string) { if _, ok := t.webSeeds[url]; ok { return } - const maxRequests = 10 + // I don't think Go http supports pipelining requests. However we can have more ready to go + // right away. This value should be some multiple of the number of connections to a host. I + // would expect that double maxRequests plus a bit would be appropriate. + const maxRequests = 32 ws := webseedPeer{ peer: Peer{ t: t, outgoing: true, Network: "http", reconciledHandshakeStats: true, - // TODO: Raise this limit, and instead limit concurrent fetches. - PeerMaxRequests: 32, + // This should affect how often we have to recompute requests for this peer. Note that + // because we can request more than 1 thing at a time over HTTP, we will hit the low + // requests mark more often, so recomputation is probably sooner than with regular peer + // conns. ~4x maxRequests would be about right. + PeerMaxRequests: 128, RemoteAddr: remoteAddrFromUrl(url), callbacks: t.callbacks(), },