Skip to content

Commit

Permalink
Introduce configurable parallelism
Browse files Browse the repository at this point in the history
  • Loading branch information
afterdusk committed Nov 20, 2024
1 parent 61714f8 commit 90deb76
Show file tree
Hide file tree
Showing 15 changed files with 409 additions and 166 deletions.
3 changes: 0 additions & 3 deletions akd/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ experimental = ["akd_core/experimental"]
default = [
"public_auditing",
"parallel_vrf",
"parallel_azks",
"preload_history",
"greedy_lookup_preload",
"experimental",
Expand All @@ -28,8 +27,6 @@ bench = ["experimental", "public_tests", "tokio/rt-multi-thread"]
# Greedy loading of lookup proof nodes
greedy_lookup_preload = []
public_auditing = ["dep:protobuf", "akd_core/protobuf"]
# Parallelize node fetch and insertion during publish
parallel_azks = []
# Parallelize VRF calculations during publish
parallel_vrf = ["akd_core/parallel_vrf"]
# Enable pre-loading of the nodes when generating history proofs
Expand Down
20 changes: 17 additions & 3 deletions akd/benches/azks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ extern crate criterion;

mod common;

use akd::append_only_zks::InsertMode;
use akd::append_only_zks::{AzksParallelismConfig, InsertMode};
use akd::auditor;
use akd::storage::manager::StorageManager;
use akd::storage::memory::AsyncInMemoryDatabase;
Expand Down Expand Up @@ -57,6 +57,7 @@ fn batch_insertion<TC: NamedConfiguration>(c: &mut Criterion) {
&db,
initial_node_set.clone(),
InsertMode::Directory,
AzksParallelismConfig::default(),
))
.unwrap();
(azks, db, node_set.clone())
Expand All @@ -67,6 +68,7 @@ fn batch_insertion<TC: NamedConfiguration>(c: &mut Criterion) {
&db,
node_set,
InsertMode::Directory,
AzksParallelismConfig::default(),
))
.unwrap();
},
Expand Down Expand Up @@ -107,6 +109,7 @@ fn audit_verify<TC: NamedConfiguration>(c: &mut Criterion) {
&db,
initial_node_set.clone(),
InsertMode::Directory,
AzksParallelismConfig::default(),
))
.unwrap();

Expand All @@ -118,12 +121,18 @@ fn audit_verify<TC: NamedConfiguration>(c: &mut Criterion) {
&db,
node_set.clone(),
InsertMode::Directory,
AzksParallelismConfig::default(),
))
.unwrap();

let end_hash = runtime.block_on(azks.get_root_hash::<TC, _>(&db)).unwrap();
let proof = runtime
.block_on(azks.get_append_only_proof::<TC, _>(&db, 1, 2))
.block_on(azks.get_append_only_proof::<TC, _>(
&db,
1,
2,
AzksParallelismConfig::default(),
))
.unwrap();

(start_hash, end_hash, proof)
Expand Down Expand Up @@ -172,7 +181,12 @@ fn audit_generate<TC: NamedConfiguration>(c: &mut Criterion) {
|| {},
|_| {
let _proof = runtime
.block_on(azks.get_append_only_proof::<TC, _>(&db, epoch - 1, epoch))
.block_on(azks.get_append_only_proof::<TC, _>(
&db,
epoch - 1,
epoch,
AzksParallelismConfig::default(),
))
.unwrap();
},
BatchSize::PerIteration,
Expand Down
Loading

0 comments on commit 90deb76

Please sign in to comment.