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

use segregated hashmap to boost the freelist allocate and release performance #141

Merged
merged 1 commit into from Jan 25, 2019

Conversation

WIZARD-CXY
Copy link
Contributor

@WIZARD-CXY WIZARD-CXY commented Jan 22, 2019

In this pr, I use segregated hashmap to replace the original freeids allocating and releasing approach.
It is much faster than the original version, especially when the db size is large or the fragmentation in the db is large, we can gain 1000x faster performance.

@WIZARD-CXY WIZARD-CXY changed the title use segregated hashmap to boost the freelist allocate and release per… use segregated hashmap to boost the freelist allocate and release performance Jan 22, 2019
freelist.go Outdated Show resolved Hide resolved
freelist.go Outdated Show resolved Hide resolved
freelist_hmap.go Outdated Show resolved Hide resolved
freelist_test.go Outdated Show resolved Hide resolved
freelist.go Outdated Show resolved Hide resolved
freelist.go Outdated Show resolved Hide resolved
freelist.go Show resolved Hide resolved
freelist.go Outdated Show resolved Hide resolved
freelist_test.go Outdated Show resolved Hide resolved
freelist_test.go Outdated Show resolved Hide resolved
Makefile Outdated Show resolved Hide resolved
Makefile Outdated Show resolved Hide resolved
freelist_test.go Outdated Show resolved Hide resolved
db.go Outdated Show resolved Hide resolved
db.go Outdated Show resolved Hide resolved
@WIZARD-CXY
Copy link
Contributor Author

@xiang90 ptal

db_test.go Outdated Show resolved Hide resolved
@xiang90
Copy link
Contributor

xiang90 commented Jan 24, 2019

@WIZARD-CXY Awesome work!

can you ask @hormes to give this a final look (especially on the tests)?

db.go Show resolved Hide resolved
db.go Show resolved Hide resolved
@xiang90
Copy link
Contributor

xiang90 commented Jan 24, 2019

/cc @jpbetz

freelist_test.go Outdated Show resolved Hide resolved
@WIZARD-CXY
Copy link
Contributor Author

For the compatibility reason, I keep all the old test which is used to test the old array freelist type and make them pass. The new approach is using the same test and make it fully passed.

@hormes
Copy link

hormes commented Jan 25, 2019

Everything looks good to me. @xiang90

db.go Outdated Show resolved Hide resolved
db.go Outdated Show resolved Hide resolved
@xiang90
Copy link
Contributor

xiang90 commented Jan 25, 2019

lgtm

@xiang90 xiang90 merged commit 8693da9 into etcd-io:master Jan 25, 2019
thaJeztah added a commit to thaJeztah/containerd that referenced this pull request Feb 21, 2019
Relevant changes:

- ectd-io/bbolt#139 update the freelist readIDs
- etcd-io/bbolt#140 add getFreePageIDs
- etcd-io/bbolt#141 use segregated hashmap to boost the freelist allocate and release performance

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
@Doyle-net
Copy link

In this pr, I use segregated hashmap to replace the original freeids allocating and releasing approach.
It is much faster than the original version, especially when the db size is large or the fragmentation in the db is large, we can gain 1000x faster performance.

Hello, may I ask
Does the new version of ETCD already have this feature?

@WIZARD-CXY
Copy link
Contributor Author

In this pr, I use segregated hashmap to replace the original freeids allocating and releasing approach.
It is much faster than the original version, especially when the db size is large or the fragmentation in the db is large, we can gain 1000x faster performance.

Hello, may I ask
Does the new version of ETCD already have this feature?

yeah

@yydzhou
Copy link

yydzhou commented Apr 21, 2022

Hi @WIZARD-CXY Thanks so much for the etcd performance optimization contribution.
Since you mentioned the new algorithm is in the new version of etcd, does that mean the description of "recommand 8GB" storage in this link is not truth anymore? https://etcd.io/docs/v3.5/dev-guide/limit/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants