-
Notifications
You must be signed in to change notification settings - Fork 602
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
HardMaxCacheSize exceeded #139
Comments
I think it's a config bug, both in your code and in ours. Things are removed from the cache (after eviction) at the @janisz or @cristaloleg, can you confirm that is indeed the case? |
Yeah, sorry, I've missed config := Config{
Shards: 256,
CleanWindow: 1 * time.Second,
LifeWindow: 10 * time.Second,
MaxEntriesInWindow: entries,
MaxEntrySize: 2 * valueSize,
Verbose: true,
HardMaxCacheSize: 1,
} and set
|
What version of go are you using? |
go version go1.12.5 darwin/amd64 |
@tetafro if looks like the problem you mention is related to initial shard size that could be bigger than hard max cache size. I think we should return error in big cache init function but this may break existing installations where users may use smaller values to prevent cache from growing |
Ive just discovered this myself and was surprised based on the description in the doco:
Would limiting the initial shard size to the maximum shard size here fix the problem? Lines 306 to 312 in fcb069f
|
I think we should add validation. If initial size is bigger than max size then we should return error or just log it to keep backward compatibility. |
Might be worth updating the fairly strong assertion in the readme to clarify when the hard limit wont be honored as well? |
Sure, @scottgerring would you like to contribute a patch? |
IMO this function
Should be something like:
wdyt @janisz @scottgerring ? |
LGTM |
Sorry if this is a complete duplicate of #18 , but that issue is 3 years old. And I see the same problem.
I even took the code from that issue. Here is my output:
Quite unexpected for
HardMaxCacheSize: 1
.The text was updated successfully, but these errors were encountered: