Skip to content

StoreGateway: Optimize filtering users during intial sync #5675

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

Closed

Conversation

harry671003
Copy link
Contributor

What this PR does:

  • Finding the sub ring for a user is a computationally expensive if
  • It takes about 46 ms to compute the sub ring for a user under these conditions.
    • 512 tokens per store-gateway
    • 350 store-gateways
    • shard size = 90%
  • If there are lots of users in the cluster, the total time can be a lot.
    • For example if there are 20,000 users it'll take about ~15 mins to filter users.
    • 20,000 * 46ms / 1000ms / 60s = ~15 mins
  • This is an attempt at optimizing this by using additional cores on the machine.
  • Instead of using a single go routine (which runs on a single core), we can use runtime.NumCPU() concurrency to filter users in multiple cores.

Results:
I saw significant improvement in filtering. The time went from 15 mins to 3 mins.

Before:

ts=2023-11-23T02:49:58.737035299Z caller=bucket_stores.go:233 level=info msg="Finished filtering users" users=37115 elapsed=32m37.846198184s

After:

ts=2023-11-23T22:29:07.14464567Z caller=bucket_stores.go:233 level=info msg="Finished filtering users" users=37580 elapsed=3m44.923125472s

Which issue(s) this PR fixes:
Fixes #

Checklist

  • Tests updated
  • Documentation added
  • CHANGELOG.md updated - the order of entries should be [CHANGE], [FEATURE], [ENHANCEMENT], [BUGFIX]

Signed-off-by: 🌲 Harry 🌊 John 🏔 <johrry@amazon.com>
Signed-off-by: 🌲 Harry 🌊 John 🏔 <johrry@amazon.com>
@harry671003
Copy link
Contributor Author

This is no longer required if the tenant-delete-mark.json can be moved outside the tenant dir.
#5676

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant