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

Make full use of aofrwblock's buf #8975

Merged
merged 2 commits into from
May 30, 2021
Merged

Conversation

ShooterIT
Copy link
Collaborator

  1. 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.

  2. 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.

Make aof rewrite buffer memory size more accurate, before, there may be 20%
deviation with its real memory usage.
@oranagra oranagra added the state:to-be-merged The PR should be merged soon, even if not yet ready, this is used so that it won't be forgotten label May 22, 2021
oranagra
oranagra previously approved these changes May 27, 2021
src/aof.c Outdated Show resolved Hide resolved
/* 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) {
Copy link
Collaborator Author

@ShooterIT ShooterIT May 27, 2021

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.

@oranagra oranagra merged commit 58a03ec into redis:unstable May 30, 2021
@ShooterIT ShooterIT deleted the aofrwblock branch May 30, 2021 13:33
JackieXie168 pushed a commit to JackieXie168/redis that referenced this pull request Sep 8, 2021
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.
@oranagra
Copy link
Member

pity, looks like this change is never gonna see the light of day (whole thing is deleted in #9788).
looks like i didn't plan to put it in the release notes anyway, but maybe backport to 6.2 some day? (maybe it has some dependency of #8968)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
state:to-be-merged The PR should be merged soon, even if not yet ready, this is used so that it won't be forgotten
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants