-
Notifications
You must be signed in to change notification settings - Fork 43
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
Added explanation of maxmemory for replication. #194
Conversation
Added how to monitor eviction The change addresses [valkey-io#166](valkey-io#166) Signed-off-by: Anastasia Alexadrova <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me.
@Redoubts Please take a look!
topics/lru-cache.md
Outdated
@@ -81,6 +85,13 @@ So we continuously cross the boundaries of the memory limit, by going over it, a | |||
|
|||
If a command results in a lot of memory being used (like a big set intersection stored into a new key) for some time, the memory limit can be surpassed by a noticeable amount. | |||
|
|||
## Monitor eviction | |||
|
|||
To monitor the point when Valkey starts to evict data, use the `INFO MEMORY` output. Compare the current memory usage displayed in the `used_memory` output with the `maxmemory` value. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this correct tho? used_memory
appears to include replication buffers and the like, whereas used_memory_dataset
seems to account for the "output buffers needed to feed the replicas are subtracted from the used memory count" part.
Signed-off-by: Anastasia Alexadrova <[email protected]>
@Redoubts Are you happy with the last updates? To answer you question in the issue:
Eviction is triggered by Should we update the text in the config file too in some way? |
I guess that's surprising to hear, since when I asked a similar question to the Redis project, they included:
is this a documented difference from Redis, or am I misunderstanding something? |
Ohh... TBH, I'm not really sure and our docs don't say... I guess the best way to be sure to go to the source code. It appears that you (and Redis) are right. This is the function that computes how much memory needs to be freed by eviction, getMaxmemoryState: https://github.com/valkey-io/valkey/blob/unstable/src/evict.c#L380. And this function computes the memory to be excluded from the total used memory, the AOF and replica output buffers, freeMemoryGetNotCountedMemory: https://github.com/valkey-io/valkey/blob/unstable/src/evict.c#L320 So the text in the valkey.conf is correct.
Now, your question is if there is any field in INFO that can show this subtracted memory size. I don't know. @enjoy-binbin, @madolson do you know? If there is no such field, should we add one? |
we do have a |
Thanks @enjoy-binbin! So we can describe the condition for eviction with this formula of configs and info fields?
|
yes, that is updateMaxmemory warning:
|
@nastena1606 Can you involve |
Signed-off-by: Anastasia Alexadrova <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @nastena1606! This looks great.
Signed-off-by: Viktor Söderqvist <[email protected]>
Added how to monitor eviction
The change closes #166