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

Time-sliced map store #3

Closed
wants to merge 1 commit into from

Conversation

Snawoot
Copy link

@Snawoot Snawoot commented Oct 3, 2023

This set of changes tries to improve MapLimitStore in order to get rid of full hash table scans in cleanup goroutine.

What's changed:

  • Storage size counter is now maintained through bookkeeping to avoid iterations over time slices.
  • Values are stored in tiered maps, each time slice is a separate map. It allows to expire all old values through simple deletion of old maps.
  • Expiration logic was adjusted to guarantee values within expiration time will be retained. So we need to delete time slices with window which is twice older as expiration time to be sure.
  • No last update time is associated with each value anymore.

@Snawoot
Copy link
Author

Snawoot commented Oct 3, 2023

Technicaly with that logic we could even get rid of background goroutine, doing cleanups in-band of Inc or Get calls. But I decided to leave it as it is for now to retain backwards compatibility.

@Snawoot Snawoot closed this by deleting the head repository Sep 30, 2024
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.

1 participant