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

lib/storage: adds nextIndexDB to mitigate performance degradation on #4626

Closed
wants to merge 1 commit into from

Conversation

f41gh7
Copy link
Contributor

@f41gh7 f41gh7 commented Jul 13, 2023

indexDB rotation

Previously, during indexDB dateMetricID cache was reseted and it caused a lot of new records creation. It may saturate memory usage, since lookups for exist entries were made.
With new logic, daily index records will be pre-created at the 1 hour before indexDB rotation.
There is no need to reset dateMetricID cache, since it belongs to indexDB. It greatly improves perforamnce.
It should help to implement next feature #4563

indexDB rotation

Previously, during indexDB dateMetricID cache was reseted and it caused
a lot of new records creation. It may saturate memory usage, since
lookups for exist entries were made.
With new logic, daily index records will be pre-created at the 1 hour
before indexDB rotation.
There is no need to reset dateMetricID cache, since it belongs to
indexDB. It greatly improves perforamnce.
It should help to implement next feature #4563
@f41gh7 f41gh7 requested review from valyala and hagen1778 July 13, 2023 07:53
@codecov
Copy link

codecov bot commented Jul 13, 2023

Codecov Report

Patch coverage: 83.64% and project coverage change: +0.07 🎉

Comparison is base (bca8ae0) 61.96% compared to head (184e15f) 62.03%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4626      +/-   ##
==========================================
+ Coverage   61.96%   62.03%   +0.07%     
==========================================
  Files         373      373              
  Lines       69230    69293      +63     
==========================================
+ Hits        42899    42988      +89     
+ Misses      24042    24015      -27     
- Partials     2289     2290       +1     
Impacted Files Coverage Δ
lib/storage/storage.go 75.01% <82.43%> (+0.58%) ⬆️
lib/storage/index_db.go 72.31% <100.00%> (+0.36%) ⬆️

... and 5 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@@ -65,6 +65,9 @@ type indexDB struct {
// The counter for time series which were re-populated from previous indexDB after the rotation.
timeseriesRepopulated uint64

// The counter for daily index records which were re-populated from current indexDB to the new indexDB before the rotation.
dailyIndexRecordsRepopulated uint64
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it is unclear when this counter increases:

  1. When current indexDB is used to re-populate entires for new indexDB object
  2. Or when current indexDB gets new entries from previous IndexDB object.

@f41gh7 f41gh7 closed this Jul 17, 2023
@f41gh7
Copy link
Contributor Author

f41gh7 commented Jul 17, 2023

Will create separate PR

@f41gh7 f41gh7 deleted the gh-4563 branch July 17, 2023 09:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants