-
Notifications
You must be signed in to change notification settings - Fork 6.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ingesting a file causes high read pressure #3104
Comments
file ingestion has an optimization that prevented me from just checking file endpoints. That optimization allows files to be ingested into lower levels even if their endpoints overlap with files at higher levels, as long as the higher-level file does not have any keys in the ingested file's key-range. So even before range deletion it would open the higher-level file to check whether this condition holds. I guess the problem is worse now. Do you know where the tens of GBs is coming from? Is it only from opening the files and reading range tombstone block? We can likely optimize it. |
I captured a flame graph when the disk was reading at full speed here: |
Hi, any update or any idea how to optimize it? Anything we can help? |
Can we cache all the delete range blocks to avoid re-read from SST? Maybe like |
Maybe we can also use a map to cache the files which contain the range del block to avoid checking all files. |
Can we just check the file endpoints if we don't mind to disable this optimization? Or, since we haven't used delete range in production yet, can we add an option to disable delete range, so that we don't need to check the delete ranges in file ingestion? |
We only need read delete range marks from these files which overlap with the sst file is about to ingest. |
We found some conflict when compaction type is not universal, since we need check overlap here, the previous checks is redundant. |
The previous check is needed in order to ingest files into the lowest possible level. For example,
What we do is:
Whether or not we should keep this behavior, I'm not sure. But I do think that the second commit in your PR would prevent the file from ingesting into L2. |
It feels kind of surprising that we check more than one file at each level. cc @IslamAbdelRahman - can we just check the one that overlaps the ingested file (if multiple overlap that implies there must be keys overlapping the ingested file's range so no need to continue)? |
I'll look at the code around it, but first questions that comes to my mind
|
For the second point, I'd prefer to optimize it so range deletions don't add overhead when they're not used. I don't think there's anything fundamentally preventing it -- we already opened the file to check regular keys so we can easily see whether a range deletion meta-block exists without any extra I/O. We just need to find time to implement it. |
Hi, want to try out #3179? In my testing it only reads range deletions from the relevant files. |
Awesome! We will test it out ASAP and give some feedback later. |
Hi, we have been testing #3179 for a while, so far so good, it's very stable now, good job! |
Thanks @huachaohuang! Please let me know if you notice any more issues. |
In the current implementation, ingesting a file needs to check if the file is overlapped with each level. For each level, all files at that level will be opened and prefetched (512K), to collect all the delete ranges at that level. Then each delete range of that level will be checked to see if it is overlapped with the ingesting file.
For an instance with tens of thousands files, ingesting a file without overlap will open and prefetch all files, which causes tens of gigabytes read flow.
Do we really need to check all delete ranges of all files at a level to see whether the ingesting file is overlapped?
Is it possible to optimize it so that we just need to check some boundaries?
@ajkr
The text was updated successfully, but these errors were encountered: