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

add badger as alternative state database #4859

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

fubss
Copy link
Contributor

@fubss fubss commented May 14, 2024

Type of change

  • New feature

Description

BadgerDB was added as alternative for GolevelDB state database.
Choosing the better alternative for the GolevelDB was a goal of my research within the paper "A Journey Towards the Most Efficient State Database For Hyperledger Fabric":

This PR adds Badger because it showed better performance results in comparison with GolevelDB, Bbolt and RocksDB.

PR satisfies potential future items of the current Hyperledger Fabric Roadmap where the goal to replace the GolevelDB with faster database is mentioned.

Additional details

Detailed Hyperledger Fabric performance reports mentioned in the papers above are availiable here. They were made using Hyperledger Caliper tool. The tool was used to measure main performance metrics on HLF peer with default GolevelDB and integrated Badger, Bbolt and RocksDB. More measuring details are described in the aforementioned studies.

To demonstrate Badger's potential advantage over GolevelDB, go benchmarks were added to the packages leveldbhelper and badgerdbhelper respectively. The results measured locally show that Badger has better performance for "put" operations than GolevelDB. The output is:

GolevelDB

go test -benchmem -run=^$ -bench ^BenchmarkLevelDBHelper$ github.com/hyperledger/fabric/common/ledger/util/leveldbhelper
goos: darwin
goarch: arm64
pkg: github.com/hyperledger/fabric/common/ledger/util/leveldbhelper
BenchmarkLevelDBHelper/get-leveldb-little-data-10                5452860               189.3 ns/op           108 B/op          4 allocs/op
BenchmarkLevelDBHelper/put-leveldb-10                                673           2768479 ns/op             248 B/op          3 allocs/op
BenchmarkLevelDBHelper/put-leveldb-type-2-10                         415           2560133 ns/op             204 B/op          3 allocs/op
PASS
ok      github.com/hyperledger/fabric/common/ledger/util/leveldbhelper  7.145s

Badger

 go test -benchmem -run=^$ -bench ^BenchmarkBadgerDBHelper$ github.com/hyperledger/fabric/common/ledger/util/badgerdbhelper
goos: darwin
goarch: arm64
pkg: github.com/hyperledger/fabric/common/ledger/util/badgerdbhelper
BenchmarkBadgerDBHelper/get-badgerdb-little-data-10          1388515               727.7 ns/op           410 B/op          8 allocs/op
BenchmarkBadgerDBHelper/put-badgerdb-10                           207873              5808 ns/op            1408 B/op         37 allocs/op
BenchmarkBadgerDBHelper/put-badgerdb-type-2-10                171474              7206 ns/op            1477 B/op         37 allocs/op
PASS
ok      github.com/hyperledger/fabric/common/ledger/util/badgerdbhelper 13.984s

The changes were tested locally and with GitHub CI/CD.

@fubss fubss requested a review from a team as a code owner May 14, 2024 19:49
@C0rWin
Copy link
Contributor

C0rWin commented May 15, 2024

@fubss Thanks; I believe switching to a more performant k/v is a valuable contribution. However, such changes warrant the need to start with RFC first. Please follow the link and submit your proposal here.

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

Successfully merging this pull request may close these issues.

2 participants