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

Configurable repository and commit cache #4910

Merged
merged 2 commits into from
Jan 1, 2023
Merged

Conversation

nopcoder
Copy link
Contributor

@nopcoder nopcoder commented Jan 1, 2023

Close #4637

  • Configurable cache size for repository and commit information.
  • Increase the size of commit cache from 1k to 50k items.
  • Increase the expiry of commit cache from 5sec to 10min.

Enable lakefs.yaml cache config for graveler's
repository and commit cache.
@nopcoder nopcoder added the include-changelog PR description should be included in next release changelog label Jan 1, 2023
@nopcoder nopcoder requested review from N-o-Z and arielshaqed January 1, 2023 07:29
@nopcoder nopcoder self-assigned this Jan 1, 2023
Copy link
Contributor

@arielshaqed arielshaqed left a comment

Choose a reason for hiding this comment

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

THANKS!

@@ -449,3 +450,19 @@ func (c *Config) GetUIEnabled() bool {
func (c *Config) GetLoginDuration() time.Duration {
return c.values.Auth.LoginDuration
}

func (c *Config) GravelerRepositoryCacheConfig() ref.CacheConfig {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
func (c *Config) GravelerRepositoryCacheConfig() ref.CacheConfig {
func (c *Config) GetGravelerRepositoryCacheParams() ref.CacheConfig {

for consistency, e.g. like GetBlockAdapterS3Params. Also below?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks - I'll address the new/old practice in a different pr

GravelerRepositoryCacheJitterKey = "graveler.repository_cache.jitter"
DefaultGravelerRepositoryCacheJitter = DefaultGravelerRepositoryCacheExpiry / 2
GravelerCommitCacheSizeKey = "graveler.commit_cache.size"
DefaultGravelerCommitCacheSize = 50000
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit:

Suggested change
DefaultGravelerCommitCacheSize = 50000
DefaultGravelerCommitCacheSize = 50_000

:-)

GravelerCommitCacheExpiryKey = "graveler.commit_cache.expiry"
DefaultGravelerCommitCacheExpiry = 30 * time.Second
GravelerCommitCacheJitterKey = "graveler.commit_cache.jitter"
DefaultGravelerCommitCacheJitter = DefaultGravelerCommitCacheExpiry / 2
Copy link
Contributor

Choose a reason for hiding this comment

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

This seems very high, we want a long expiry time. And if it's inconsistent, FindMergeBase may take very different times to do the exact same thing.

Suggested change
DefaultGravelerCommitCacheJitter = DefaultGravelerCommitCacheExpiry / 2
DefaultGravelerCommitCacheJitter = 2 * time.Second

Copy link
Contributor Author

@nopcoder nopcoder Jan 1, 2023

Choose a reason for hiding this comment

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

Agree - I also not sure jitter is needed for these type of cache.
I'll update both to 2 seconds

GravelerCommitCacheSizeKey = "graveler.commit_cache.size"
DefaultGravelerCommitCacheSize = 50000
GravelerCommitCacheExpiryKey = "graveler.commit_cache.expiry"
DefaultGravelerCommitCacheExpiry = 30 * time.Second
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice... but even this seems low! What's the harm in keeping something in the commit cache? Even 5 minutes seems reasonable.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No harm - updated the size and forgot to update the expiry. Setting to 10min - comment if you think we should go higher.

@nopcoder nopcoder merged commit f67e2a8 into master Jan 1, 2023
@nopcoder nopcoder deleted the feature/config-cache branch January 1, 2023 10:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
include-changelog PR description should be included in next release changelog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow configuring the commit cache parameters: size, timing
2 participants