forked from apache/pulsar
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[TIEREDSTORAGE] Only seek when reading unexpected entry (apache#5356)
* [TIEREDSTORAGE] Only seek when reading unexpected entry The normal pattern from reading from an offloaded ledger is that the reader will read the ledger sequentially from start to end. This means that once a user reads an entry, we should expect that the next entry they read will be the next entry in the ledger. The initial implementation of the BlobStoreBackedReadHandleImpl (and the S3 variant that preceeded it) didn't take this into account. Instead it did a lookup in the index each time, to find the block that contained the entry, and then read forward in the block until it found the entry requested. This is fine for the first few entries in the block, not so much for the last. This PR changes the read behaviour to only seek if entryId read from the block is either: - greater than the entry we were expecting to read, in which case we need to seek backwards in the block. - less than the entry expected, but also belonging to a different block to the expected entry, in which case we need to seek to the correct block. This change improves read performance significantly. Adhoc benchmarks shows that we can read from offloaded topics at ~160MB/s whereas previously we could only manage <10MB/s. * Revert it back to debug
- Loading branch information
Showing
4 changed files
with
23 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters