-
Notifications
You must be signed in to change notification settings - Fork 23.6k
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
Add overhead of all DBs and rehashing dict count to info. #12913
Add overhead of all DBs and rehashing dict count to info. #12913
Conversation
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.
good idea. but i think i'd like a few changes:
- i don't think we need to have separate metric for the expires dict and the main one, we can count them together in the same metric.
- i'd like another metric to count the overhead of the rehashing (i.e. the total memory used by
ht[0]
in dicts that also haveht[1]
)
WDYT?
I like this idea, but one concern is that cluster with 16384 slots, in the worst case scenario, we would need to iterate through all the slots to obtain complete information about ht[0] and ht[1]. Perhaps we need to use |
yes, let's do that (keep track of it rather than calculate it on the spot) |
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.
@redis/core-team please approve the new metrics for INFO MEMORY and MEMORY STATS
Now that "kvstore" is merged, I have to rewrite a lot of things.
And since Or we can maintain the overhead inside kvstore structure and when |
…rhead when keycount == 0.
Just realized that in test "Redis can resize empty dict" in other.tcl, it is assumed that |
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.
Just realized that in test "Redis can resize empty dict" in other.tcl, it is assumed that memory stats shows only the overhead of non-empty DBs. But now all DBs' overhead is displayed and so we need to change the test.
i see the test passes, what do you mean?
the deletion of this?
# Set a key to enable overhead display of db 0
r set a b
or do you mean we need another way to distinguish between empty and non empty dicts?
The test should read However in this PR The test would also pass if it reads other DB's overhead, but that's meaningless. |
ohh, you mean that so far it just looked for any let's wait to see if @soloestoy has anything else to argue and then merge it. |
@soloestoy Any more problems? |
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.
@oranagra please approve the new naming database.dict.rehashing.count
and the change about kvstoreMemUsage
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.
i'm ok with the new name.
please update the top comment, and prepare a redis-doc PR
My OCD is kicking... I feel it's best to add "db" to the names of these metrics to avoid the misunderstanding that they refer to all hash data types: INFO MEMORY
MEMORY STATS
about the db prefix error, @CharlesChen888 could you change |
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.
LGTM
The corresponding doc PR of redis/redis#12913 --------- Co-authored-by: Oran Agra <oran@redislabs.com>
Just retrospectively acknowledging that the updating wording seems better to me as well. |
…#13103) The new regular expression break the validator: ``` In file included from commands.c:10: commands_with_reply_schema.def:14528:72: error: stray ‘\’ in program 14528 | struct jsonObjectElement MEMORY_STATS_ReplySchema_patternProperties__db\_\d+__properties_overhead_hashtable_main_elements[] = { ``` The reason is that special characters are not added to to_c_name, causes special characters to appear in the structure name, causing c file compilation to fail. Broken by #12913
Sometimes we need to make fast judgement about why Redis is suddenly taking more memory. One of the reasons is main DB's dicts doing rehashing.
We may use
MEMORY STATS
to monitor the overhead memory of each DB, but there still lacks a total sum to show an overall trend. So this PR adds the total overhead of all DBs toINFO MEMORY
section, together with the total count of rehashing DB dicts, providing some intuitive metrics about main dicts rehashing.This PR adds the following metrics to INFO MEMORY
mem_overhead_db_hashtable_rehashing
- only size of ht[0] in dictionaries we're rehashing (i.e. the memory that's gonna get released soon)and a similar ones to MEMORY STATS:
overhead.db.hashtable.lut
(complements the existingoverhead.hashtable.main
andoverhead.hashtable.expires
which also counts thedictEntry
structs too)overhead.db.hashtable.rehashing
- temporary rehashing overhead.db.dict.rehashing.count
- number of top level dictionaries being rehashed.