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

Allow Azks parallelism to be configurable #457

Merged
merged 5 commits into from
Nov 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Changelog

## 0.12.0-pre.11 (Nov 21, 2024)
* Added parallelization for node preloads during audit proof generation
* Removed `parallel_azks` feature in favor of explicit parallelism configuration object allowing the
setting of static or dynamic parallelism across insertion and preloads

## 0.12.0-pre.10 (Oct 17, 2024)
* Added parallelization for node preloads during insertion
* Added support for [tracing](https://docs.rs/tracing/latest/tracing/index.html)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Installation
Add the following line to the dependencies of your `Cargo.toml`:

```
akd = "0.12.0-pre.10"
akd = "0.12.0-pre.11"
```

### Minimum Supported Rust Version
Expand Down
7 changes: 2 additions & 5 deletions akd/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "akd"
version = "0.12.0-pre.10"
version = "0.12.0-pre.11"
authors = ["akd contributors"]
description = "An implementation of an auditable key directory"
license = "MIT OR Apache-2.0"
Expand All @@ -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 All @@ -56,7 +53,7 @@ tracing_instrument = ["tracing/attributes"]

[dependencies]
## Required dependencies ##
akd_core = { version = "0.12.0-pre.10", path = "../akd_core", default-features = false, features = [
akd_core = { version = "0.12.0-pre.11", path = "../akd_core", default-features = false, features = [
"vrf",
] }
async-recursion = "1"
Expand Down
27 changes: 23 additions & 4 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 @@ -157,7 +166,12 @@ fn audit_generate<TC: NamedConfiguration>(c: &mut Criterion) {
for _epoch in 0..num_epochs {
let node_set = gen_nodes(&mut rng, num_leaves);
runtime
.block_on(azks.batch_insert_nodes::<TC, _>(&db, node_set, InsertMode::Directory))
.block_on(azks.batch_insert_nodes::<TC, _>(
&db,
node_set,
InsertMode::Directory,
AzksParallelismConfig::default(),
))
.unwrap();
}
let epoch = azks.get_latest_epoch();
Expand All @@ -172,7 +186,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
5 changes: 4 additions & 1 deletion akd/benches/directory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ extern crate criterion;

mod common;

use akd::append_only_zks::AzksParallelismConfig;
use akd::ecvrf::HardCodedAkdVRF;
use akd::storage::manager::StorageManager;
use akd::storage::memory::AsyncInMemoryDatabase;
Expand Down Expand Up @@ -56,7 +57,9 @@ fn history_generation<TC: NamedConfiguration>(c: &mut Criterion) {
);
let db_clone = db.clone();
let directory = runtime
.block_on(async move { Directory::<TC, _, _>::new(db, vrf).await })
.block_on(async move {
Directory::<TC, _, _>::new(db, vrf, AzksParallelismConfig::default()).await
})
.unwrap();

for _epoch in 1..num_updates {
Expand Down
Loading
Loading