Skip to content

improve malloc efficiency: reduce call times of zrealloc#10533

Merged
madolson merged 2 commits intoredis:unstablefrom
f20500909:dev_slot_info_pairs
Apr 10, 2022
Merged

improve malloc efficiency: reduce call times of zrealloc#10533
madolson merged 2 commits intoredis:unstablefrom
f20500909:dev_slot_info_pairs

Conversation

@f20500909
Copy link
Copy Markdown
Contributor

@f20500909 f20500909 commented Apr 5, 2022

What this PR does :

  1. Remove confusing fields :slot_info_pairs_alloc

slot_info_pairs_alloc is used to preallocate slot_info_pairs memory size.But slot_info_pairs_count is fixed for one unique clusterNode and It less than 2*n->numslots. So I remove field slot_info_pairs_alloc,use 2*n->numslots instead.

  1. Performance improvement

To one unique clusterNode,function zrealloc is called only once after modification.So this PR reduce the call times of brk system call and reduces memory fragmentation.

Related PR:
improve malloc efficiency for cluster slots_info_pairs #10488

Add cluster shards support : #10293

@oranagra oranagra requested a review from madolson April 5, 2022 15:58
@madolson
Copy link
Copy Markdown
Contributor

Copy link
Copy Markdown
Contributor

@madolson madolson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this tradeoff makes sense.

@madolson madolson merged commit ee17e7a into redis:unstable Apr 10, 2022
@f20500909 f20500909 deleted the dev_slot_info_pairs branch April 14, 2022 05:00
enjoy-binbin pushed a commit to enjoy-binbin/redis that referenced this pull request Jul 31, 2023
* improve malloc efficiency: reduce call times of zrealloc

Co-authored-by: Madelyn Olson <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

3 participants