-
Notifications
You must be signed in to change notification settings - Fork 1.1k
[IOTDB-3164] Manage the memory of cross space compaction in write memory controller #6914
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
Conversation
|
Coverage increased (+0.02%) to 42.338% when pulling ad73693 on IOTDB-3164-O into 37d6cfe on master. |
|
I use IoTDB benchmark tests changed after the performance, and the master (commit: a8f757d) are compared. The result of the comparison is shown in the figure below. In terms of average performance, the write performance after the change decreases by about 2.8%. |
| this.dataRegionId = dataRegionId; | ||
| this.timePartition = timePartition; | ||
| this.tsFileManager = tsFileManager; | ||
| this.memoryBudget = config.getCrossCompactionMemoryBudget(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
apply this memory from the storage engine, not from the whole system
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
reslove
|
|
||
| /** How much memory (in byte) can be used by a single merge task. */ | ||
| private long crossCompactionMemoryBudget = (long) (Runtime.getRuntime().maxMemory() * 0.1); | ||
| private long crossCompactionMemoryBudget = (long) (allocateMemoryForWrite * 0.1D); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The default variable is
private double compactionProportion = 0.2;
| private long crossCompactionMemoryBudget = (long) (allocateMemoryForWrite * 0.1D); | |
| private long crossCompactionMemoryBudget = (long) (allocateMemoryForWrite * 0.2D); |
|
|
||
| private static long memorySizeForWrite = config.getAllocateMemoryForWrite(); | ||
| private static long memorySizeForWrite = | ||
| (long) (config.getAllocateMemoryForWrite() * config.getMemtableProportion()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| (long) (config.getAllocateMemoryForWrite() * config.getMemtableProportion()); | |
| (long) (config.getAllocateMemoryForStorageEngine() * config.getWriteProportion()); |
|
|
||
| /** How much memory (in byte) can be used by a single merge task. */ | ||
| private long crossCompactionMemoryBudget = (long) (Runtime.getRuntime().maxMemory() * 0.1); | ||
| private long crossCompactionMemoryBudget = (long) (allocateMemoryForWrite * 0.1D); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| private long crossCompactionMemoryBudget = (long) (allocateMemoryForWrite * 0.1D); | |
| private long compactionMemoryBudget = (long) (allocateMemoryForStorageEngine * compactionProportion); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This param is removed
| @Override | ||
| protected void doCompaction() { | ||
| try { | ||
| SystemInfo.getInstance().addCompactionMemoryCost(memoryCost); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what if the allocateMemory throw interrupt exception without succeeding in adding?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I move allocateMemory in a seperate try-catch block.
…tion main execution
|
SonarCloud Quality Gate failed. |
|
|
||
| public void addCompactionMemoryCost(long memoryCost) throws InterruptedException { | ||
| long originSize = this.compactionMemoryCost.get(); | ||
| while (originSize + memoryCost > memorySizeForCompaction |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If there are two tasks call this method concurrently,
Task1 originSize = 10;
Task2 originSize = 10;
Task1.compactionMemoryCost.compacreAndSet(10, 10+30) = 40;
Task2 compareAndSet is always false, and Task2 sleeps forever.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The originSize is updated in the while block.
HTHou
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM











See IOTDB-3164.
This PR is one part of the compaction memory management. It does the following jobs:
RewriteCompactionFileSelector, which is deduplicated withRewriteCrossSpaceCompactionSelector.To complete the compaction memory management, we need to complete the following jobs: