Skip to content
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

Optimize read iops caused by delta compact #6460

Closed
flowbehappy opened this issue Dec 8, 2022 · 1 comment · Fixed by #6461
Closed

Optimize read iops caused by delta compact #6460

flowbehappy opened this issue Dec 8, 2022 · 1 comment · Fixed by #6461
Assignees
Labels
affects-6.1 This bug affects the 6.1.x(LTS) versions. affects-6.2 affects-6.3 affects-6.4 affects-6.5 This bug affects the 6.5.x(LTS) versions. component/storage severity/moderate type/enhancement The issue or PR belongs to an enhancement.

Comments

@flowbehappy
Copy link
Contributor

flowbehappy commented Dec 8, 2022

Enhancement

Currently, delta compact can cause a lot of disk read ops. Because readBlockForMinorCompaction use PageReader::read(const std::vector<PageStorage::PageReadFields> & page_fields) to read all columns data of the cftiny. And this read api does not combine the continuously reads together (another optimization opportunity).

And write amplification is also very high, especially the write workload is distributed and the data volume is large.

image

image

image

image

@flowbehappy flowbehappy added type/enhancement The issue or PR belongs to an enhancement. severity/moderate affects-5.4 This bug affects the 5.4.x(LTS) versions. component/storage affects-6.1 This bug affects the 6.1.x(LTS) versions. labels Dec 8, 2022
@flowbehappy flowbehappy self-assigned this Dec 8, 2022
@flowbehappy flowbehappy added the affects-6.5 This bug affects the 6.5.x(LTS) versions. label Dec 8, 2022
@JaySon-Huang
Copy link
Contributor

In the following codes we sort the read entries by the offset inside file, however, the read entries could from different BlobFiles. We should sort the read entries by file_id and offset to get better read locality

PageMap BlobStore::read(FieldReadInfos & to_read, const ReadLimiterPtr & read_limiter)
{
if (to_read.empty())
{
return {};
}
ProfileEvents::increment(ProfileEvents::PSMReadPages, to_read.size());
// Sort in ascending order by offset in file.
std::sort(
to_read.begin(),
to_read.end(),
[](const FieldReadInfo & a, const FieldReadInfo & b) { return a.entry.offset < b.entry.offset; });

PageMap BlobStore::read(PageIDAndEntriesV3 & entries, const ReadLimiterPtr & read_limiter)
{
if (entries.empty())
{
return {};
}
ProfileEvents::increment(ProfileEvents::PSMReadPages, entries.size());
// Sort in ascending order by offset in file.
std::sort(entries.begin(), entries.end(), [](const auto & a, const auto & b) {
return a.second.offset < b.second.offset;
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects-6.1 This bug affects the 6.1.x(LTS) versions. affects-6.2 affects-6.3 affects-6.4 affects-6.5 This bug affects the 6.5.x(LTS) versions. component/storage severity/moderate type/enhancement The issue or PR belongs to an enhancement.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants