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

Flush cache of KVStore and DeltaTree in background #6412

Closed
flowbehappy opened this issue Dec 3, 2022 · 2 comments
Closed

Flush cache of KVStore and DeltaTree in background #6412

flowbehappy opened this issue Dec 3, 2022 · 2 comments
Assignees
Labels
component/storage type/enhancement The issue or PR belongs to an enhancement.

Comments

@flowbehappy
Copy link
Contributor

flowbehappy commented Dec 3, 2022

Enhancement

Currently, the write throughput of TiFlash is limited. The worse case: most of the transactions only update a few rows randomly amount many regions. In this case, most of the flush only flush very few rows, including KVStore persist and DeltaTree flush cache. Check KVStore::tryFlushRegionData for details.

image

The flush requests are mostly from CompactLog in raft logs. Currently, we use flash.compact_log_min_period to control the execution frequency of CompactLog. But there are still too many flush and cause serious write performance issue, especially when there are many regions and the total CompactLogs are very frequent. In my tests, with over 300GB of data, a TiFlash node can only support ~2.5MiB/s write throughput with the worst write pattern.

I think the ultimate solution is doing tryFlushRegionData by background threads. So foreground apply raft logs process completely ignores CompactLog commands. And the background flush threads notify raft store after they finished the flush jobs, to do the following tasks, including removing raft logs.

This optimization is expected to increase the max write throughput of TiFlash to at least 300% in the worse case. I.e. from 2.5 MiB/s to 7.5MiB/s.

@flowbehappy flowbehappy added type/enhancement The issue or PR belongs to an enhancement. component/storage labels Dec 3, 2022
@flowbehappy
Copy link
Contributor Author

The suitable flush ops of a TiFlash node should be less than 100 ops. Otherwise, there is the risk of write delay.

image

image

@JinheLin
Copy link
Contributor

Duplicated with #7564.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/storage type/enhancement The issue or PR belongs to an enhancement.
Projects
None yet
Development

No branches or pull requests

3 participants