-
Notifications
You must be signed in to change notification settings - Fork 22
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
StorageEntity cache not be cleared #353
Comments
I'm struggling with the above judgment; the checkForCacheClear method doesn't have a bug. The constantly refreshing entry.lastTouch timestamp is not the direct cause of the OOM. Let me share my findings over this period; GC is really hard:
void checkForCacheClear(final StorageEntity.Default entry, final long evalTime)
{
if(this.entityCacheEvaluator.clearEntityCache(this.usedCacheSize, evalTime, entry))
{
// use ensure method for that for purpose of uniformity / simplicity
this.ensureNoCachedData(entry);
}
else
{
controlledTouch(entry, evalTime);
}
}
private void controlledTouch(StorageEntity.Default entry, long evalTime)
{
if (evalTime - entry.lastTouched() < ACTIVE_INTERVAL)
{
entry.touch();
}
}
private static final long ACTIVE_INTERVAL = 1000; // 1000ms Then off-heap memory would be released more timely, leading to more predictable memory usage behavior and a more certain program state. Can the StorageEntity instance be written to disk? For example, using mmap, so even if millions or even billions of objects are persisted, OOM wouldn't occur. |
Thank you @54446776 for your investigation and your suggestion. I know how much time and work it is to test this in an actual production use case and come up with a logical explaination of the inner workings and a possible fix/workaround/improvement. Very much appreciated. I need to make some time to process your comment and will do another test if i can get some spare time (midnight perhaps 😃) |
Environment Details
Describe the bug
create db with config blow:
gc every minute:
StorageEntity total count keep same, will not decrease!
I debug the code and found one reason:
clearEntityCache alway return false
because checkForCacheClear in each house keep cycle refresh the touch time:
So, every 100ms house keeping refresh touch time, and then ageInMs always less than 60000ms(ageInMs even can be negative number!), lead StorageEntity will not be cleared in house-keeping thread or manual house-keeping gc!
More insert or modified objects, more entities accumulating, lead to OOM finally.
@fh-ms
The text was updated successfully, but these errors were encountered: