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

WIP: MMAP backed bucket map that is suitable as a KV store for the accounts index #18179

Closed
wants to merge 39 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
e8eb031
updates
aeyakovenko Jun 3, 2021
42bfa0e
gnarly rwlocks
aeyakovenko Jun 3, 2021
541d25b
progress
aeyakovenko Jun 14, 2021
c766aa0
update
aeyakovenko Jun 16, 2021
e49ada5
update
aeyakovenko Jun 16, 2021
7f565cb
wip
aeyakovenko Jun 19, 2021
77c3834
wip
aeyakovenko Jun 21, 2021
ad9dea0
wip
aeyakovenko Jun 22, 2021
ce552ac
update
aeyakovenko Jun 22, 2021
7cb5651
wip
aeyakovenko Jun 22, 2021
9810bd2
update
aeyakovenko Jun 23, 2021
1e79b49
cleanup
aeyakovenko Jun 23, 2021
1e71b88
remove update error
aeyakovenko Jun 23, 2021
1b0ce49
cleanup
aeyakovenko Jun 23, 2021
d36c50b
update
aeyakovenko Jun 23, 2021
3df3835
new func for bucketmap
aeyakovenko Jun 23, 2021
4791c18
bugs
aeyakovenko Jun 24, 2021
18b7098
update
aeyakovenko Jun 24, 2021
5f1635b
update
aeyakovenko Jun 24, 2021
44c0051
update
aeyakovenko Jun 24, 2021
0eae241
wip
aeyakovenko Jun 25, 2021
6b22270
wip
aeyakovenko Jun 25, 2021
3d0dc73
woot
aeyakovenko Jun 25, 2021
c67c0f4
update
aeyakovenko Jun 26, 2021
1bc7358
benches
aeyakovenko Jun 26, 2021
766f054
benches
aeyakovenko Jun 26, 2021
37b8896
move to sep package
aeyakovenko Jun 26, 2021
d48d7ff
missing
aeyakovenko Jun 26, 2021
690ad42
cleanup
aeyakovenko Jun 26, 2021
67c990d
updates
aeyakovenko Jun 26, 2021
0634622
fixed
aeyakovenko Jun 26, 2021
7f3ef49
update
aeyakovenko Jun 26, 2021
55265da
cleanup
aeyakovenko Jun 26, 2021
80ae95f
cleanup
aeyakovenko Jun 26, 2021
66b967b
unlocked collected hashes
aeyakovenko Jun 27, 2021
ae5d915
update
aeyakovenko Jun 27, 2021
75c9316
update
aeyakovenko Jun 27, 2021
de9bcf8
addref calls
aeyakovenko Jun 30, 2021
ad91e2e
fmt
jeffwashington Jun 30, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view

Some generated files are not rendered by default. Learn more.

@@ -9,6 +9,7 @@ members = [
"banks-client",
"banks-interface",
"banks-server",
"bucket_map",
"clap-utils",
"cli-config",
"cli-output",
@@ -0,0 +1,28 @@
[package]
name = "solana-bucket-map"
version = "1.8.0"
description = "solana-bucket-map"
homepage = "https://solana.com/"
documentation = "https://docs.rs/solana-bucket-map"
readme = "../README.md"
repository = "https://github.com/solana-labs/solana"
authors = ["Solana Maintainers <maintainers@solana.foundation>"]
license = "Apache-2.0"
edition = "2018"

[dependencies]
rayon = "1.5.0"
solana-logger = { path = "../logger", version = "=1.8.0" }
solana-sdk = { path = "../sdk", version = "=1.8.0" }
memmap2 = "0.2.3"
log = { version = "0.4.11" }
solana-measure = { path = "../measure", version = "=1.8.0" }
rand = "0.7.0"
fs_extra = "1.2.0"

[lib]
crate-type = ["lib"]
name = "solana_bucket_map"

[[bench]]
name = "bucket_map"
@@ -0,0 +1,78 @@
#![feature(test)]

extern crate test;
use rayon::prelude::*;
use solana_bucket_map::bucket_map::BucketMap;
use solana_sdk::pubkey::Pubkey;
use std::collections::hash_map::HashMap;
use std::sync::Arc;
use std::sync::RwLock;
use test::Bencher;

type AccountInfo = u64;

#[bench]
fn bucket_map_bench_hashmap_baseline(bencher: &mut Bencher) {
let mut index = HashMap::new();
bencher.iter(|| {
let key = Pubkey::new_unique();
index.insert(key, vec![(0, AccountInfo::default())]);
});
}

#[bench]
fn bucket_map_bench_insert_1(bencher: &mut Bencher) {
let tmpdir = std::env::temp_dir().join("bucket_map_bench_insert_1");
std::fs::create_dir_all(tmpdir.clone()).unwrap();
let drives = Arc::new(vec![tmpdir.clone()]);
let index = BucketMap::new(1, drives);
bencher.iter(|| {
let key = Pubkey::new_unique();
index.update(&key, |_| Some(vec![(0, AccountInfo::default())]));
});
std::fs::remove_dir_all(tmpdir).unwrap();
}

#[bench]
fn bucket_map_bench_insert_16x32_baseline(bencher: &mut Bencher) {
let index = RwLock::new(HashMap::new());
(0..16).into_iter().into_par_iter().for_each(|_| {
let key = Pubkey::new_unique();
index
.write()
.unwrap()
.insert(key, vec![(0, AccountInfo::default())]);
});
bencher.iter(|| {
(0..16).into_iter().into_par_iter().for_each(|_| {
for _ in 0..32 {
let key = Pubkey::new_unique();
index
.write()
.unwrap()
.insert(key, vec![(0, AccountInfo::default())]);
}
})
});
}

#[bench]
fn bucket_map_bench_insert_16x32(bencher: &mut Bencher) {
let tmpdir = std::env::temp_dir().join("bucket_map_bench_insert_16x32");
std::fs::create_dir_all(tmpdir.clone()).unwrap();
let drives = Arc::new(vec![tmpdir.clone()]);
let index = BucketMap::new(4, drives);
(0..16).into_iter().into_par_iter().for_each(|_| {
let key = Pubkey::new_unique();
index.update(&key, |_| Some(vec![(0, AccountInfo::default())]));
});
bencher.iter(|| {
(0..16).into_iter().into_par_iter().for_each(|_| {
for _ in 0..32 {
let key = Pubkey::new_unique();
index.update(&key, |_| Some(vec![(0, AccountInfo::default())]));
}
})
});
std::fs::remove_dir_all(tmpdir).unwrap();
}