peterxcli opened a new pull request, #12181: URL: https://github.com/apache/ozone/pull/12181
## What changes were proposed in this pull request? S3 Gateway serves a range GET by seeking and then copying the range from the key input stream. With `ozone.client.stream.readblock.enable=true`, each sequential read asks the datanode for the requested bytes plus `ozone.client.stream.read.pre-read-size` (32 MB by default). S3 Gateway closes the stream as soon as the range is copied, so the datanode reads up to 32 MB that nobody uses, and a small range GET is slower than without streaming. This PR reads a range that fits in S3 Gateway's copy buffer (`ozone.s3g.client.buffer.size`, 4 MB by default) with a single positioned read, which asks the datanode for the range only. Larger ranges, and streams without positioned read support, keep the seek and copy path. Without streaming, the positioned read sends the same requests as before: one `GetBlock` and one `ReadChunk` for the range. Not covered here: a range larger than the buffer still pre-reads past its end. That needs a change to the sequential pre-read and will get its own Jira. ## What is the link to the Apache JIRA https://issues.apache.org/jira/browse/HDDS-17942 ## How was this patch tested? New tests in `TestObjectGet`: - A range that fits in the buffer is read with one positioned read and no seek. - A range larger than the buffer is read with a seek. - A stream without positioned read support is read with a seek. Manual test on a 3-datanode Ratis cluster, with the setting changed on S3 Gateway only. Both columns use the same build; only the S3 Gateway jar differs. Streaming ReadBlock enabled, default pre-read size: | | master | this PR | |---|---|---| | 4 KiB range GET, datanode bytes read per GET | 2.6 - 27.2 MB | 20 KB | | 4 KiB range GET, p50 | 6.1 - 20.7 ms | 4.4 - 5.0 ms | | 1 MiB range GET, p50 | 22.2 ms | 7.9 ms | | Full GET of a 256 MiB key | 948 MB/s | 908 MB/s | Streaming ReadBlock disabled (default): | | master | this PR | |---|---|---| | 4 KiB range GET, datanode requests per GET | 1 GetBlock, 1 ReadChunk, 20 KB | same | | 4 KiB range GET, p50 | 4.7 - 5.7 ms | 4.5 - 5.4 ms | | 1 MiB range GET, p50 | 8.9 ms | 9.4 ms | The full GET path is not changed, so its difference is run-to-run variation. On the same cluster, 344 range GETs on a single-PUT key and a 4-part multipart key (ranges across part boundaries and around the buffer size) returned the uploaded bytes with streaming enabled and disabled. A Flink ForSt job reading state through S3 Gateway with streaming ReadBlock went from about 1,600 to 2,900 - 3,900 records/s. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
