-
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
Make full use of aofrwblock's buf #8975
Conversation
Make aof rewrite buffer memory size more accurate, before, there may be 20% deviation with its real memory usage.
/* This function is different from aofRewriteBufferSize, to get memory usage, | ||
* we should also count all other fields(except 'buf') of aofrwblock and the | ||
* last block's free size. */ | ||
unsigned long aofRewriteBufferMemoryUsage(void) { |
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.
hi @oranagra here, i should let you know, if we want to get aof rewrite buffer more accurate, we maybe use zmalloc_size
to get every aof_rewrite_buf_block
, but as you said, it costs much time, so I actually cumulate all aof_rewrite_buf_blocks
zmalloc_usable_size, of course, they(zmalloc_size and zmalloc_usable_size) have no difference if allocator has MALLOC SIZE.
Make aof rewrite buffer memory size more accurate, before, there may be 20% deviation with its real memory usage. The implication are both lower memory usage, and also a more accurate INFO.
AOF_RW_BUF_BLOCK_SIZE is 10M, if we use jemalloc, we will get 12M actually when we alloc aofrwblock, but we only use 10M, there is 20% waste of memory.
If we want to get aof rewrite buffer memory usage, we should also count all other fields(except 'buf') of aofrwblock and the last block's free size. Before, there may be 20% deviation with its real memory usage.