Closed KANIOYH closed 3 weeks ago
A Monitoring Scheme Based on I/O Time: Leveraging gopsutil, we can obtaindisk I/O information. We introduce a background listening coroutine that periodically retrieves the current I/O information.
Users can input an I/O time proportion threshold rate to determine whether the current disk is busy. We sample I/O Time at a fixed interval,samplingInterval
, where I/O Time represents the disk I/O execution time since the system was turned on. Two interval samples can provide the IOTime
for that period. We then compare the size of rate * samplingInterval
with IOTime
to judge whether the current I/O is busy.
感谢 PR,请修复对应的 comment,并且 rebase 一下代码。
AutoCompact & CompactWithDeprecateable
Add autoCompact support.
AutoCompact can automatically occur in the background. There are not implementation for IO state, only reserve space for it.
This feature adds a memory-based deprecated table (dptable), which marks deprecated data in the vlog based on the UUID of each operation, without the need to retrieve deprecated data through the bptree.
This feature mainly reduces the overhead of accessing the bptree.Reduced by approximately one order of magnitude.
bptreeTime:219.758243 ms > dptableTime:24.207176 ms
We need to further discuss the IO status. It is initially believed that disk-level monitoring is superior to API hooks.
disk-level monitoring | maybe useful:github.com/shirou/gopsutil
Changes
Modified the encoding format of records in the vlog to include UUID information.
Changed the value format in the bptree to include UUID information.
Added a listener coroutine responsible for triggering AutoCompact.
Introduced the CompactWithDeprecateable method, which implements compaction based on the dptable.
Modified some test functions to cover cases involving compaction.
Added relevant options.
Test Reuslt
According to a mixed read-write ratio of 5:1.
Compare
The results of comparing Compact and CompactWithDeprecatedable are as follows:
We can easily observe that bptreeTime is significantly higher than dptableTime, as it has a greater access overhead. Notably, the original compact has slightly lower overhead when modifying the B+ tree information a second time. This is likely because after the first read, there is a high probability that the cache entry exists in memory, which is a common characteristic of B+ trees.
TestDBAutoCompact