Closed rjan90 closed 1 year ago
Some more context:
PieceReader code lives in https://github.com/filecoin-project/lotus/blob/master/storage/sealer/piece_reader.go
It is essentially just a simple wrapper around a func(offset int64) io.ReadCloser
(which is basically just a getter for http-request-reader for unsealed sector data) into a io.ReadSeeker
+ a thread-safe io.ReaderAt
.
Today it is entirely optimized for a single, sequential, forward reader, which can occasionally skip forwards - which is roughly the workload we see from graphsync
The reader setup function it operates on is not the cheapest thing to call - it's starting an http request, which may imply a new tcp stream, so each call is likely a couple ms.
The ask in this issue is that we need to rewrite this logic to support random, parallel ReadAt calls with better performance (e.g. actually support reading from the sector with multiple streams)
@magik6k @rjan90 This domain/logic/code is completely foreign to me. Could you provide some basic instructions I can perform to witness the core issue locally? So I'm guessing something that performs a retrieval on an unsealed sector and takes long
Following up here, as this is an important fix that will enable SPs to serve retrievals at scale, since retrieval traffic from Saturn and the wider IP network will request smaller (<< piece size) and "random" data from SPs, not just full Pieces. In practice and through load testing (testing results, http load testing tool and example), we've seen the current limitations, so we currently heavily rate-limit Saturn nodes from requesting from SPs.
A 10x performance improvement would help us increase the rate limit to a level that should enable SPs to handle all of Project Rhea's traffic, agnostic of transport protocol, which is why we should try to get this into Lotus sooner, rather than later. Can we get it into 1.23?
Here is a link to the load testing tooling that @hannahhoward and team built for load testing: https://github.com/filecoin-project/retrieval-load-testing
Adding a bit more to what @davidd8 mentioned, we saw the impact of this specifically with the range request http load testing in Boost (this has similar access patterns as bitswap retrievals).
Re-tune the piece reader code to allow for random, parallel access to unblock retrieval bottlenecks.
Quote from Magik:
Estimated time effort: 1-2 days