Skip to main content

Crate quoracle

Crate quoracle 

Source
Expand description

Quoracle: construct, analyze, and optimize read-write quorum systems.

A read-write quorum system says which sets of nodes may serve a read and which may serve a write, such that every read set overlaps every write set. Quoracle lets you:

  • describe quorum systems with an expression algebra (a + b = either, a * b = both, choose/majority = k of n);
  • compute fault tolerance (QuorumSystem::resilience);
  • find the strategy (how often to pick each quorum) that minimizes load, network traffic, or latency for a given read/write mix, by linear programming (QuorumSystem::strategy);
  • evaluate any strategy’s load, capacity, latency and per-node load;
  • search for the best quorum system over a set of nodes (search()).

This is a Rust port of the Python Quoracle library described in Whittaker et al., “Read-Write Quorum Systems Made Practical” (PaPoC 2021).

§Example

use quoracle::{Distribution, Expr, Node, Objective, QuorumSystem,
               StrategyLimits};

// A 2x2 grid: read a full row, write one node from each row.
let [a, b, c, d] = ["a", "b", "c", "d"].map(|x| Expr::Node(Node::new(x)));
let qs = QuorumSystem::from_reads(a * b + c * d);
assert_eq!(qs.resilience(), 1);

// The load-optimal strategy for a 75%-read workload.
let fr = Distribution::fixed(0.75)?;
let strategy = qs.strategy(
    Objective::Load, Some(&fr), None, &StrategyLimits::default(), 0,
)?;
let load = strategy.load(Some(&fr), None)?;
assert!((load - 0.5).abs() < 1e-6);
// The system can serve 1 / load = 2x the throughput of a single node.
assert!((strategy.capacity(Some(&fr), None)? - 2.0).abs() < 1e-6);

§LP solvers

Strategy optimization uses [good_lp]. The default microlp feature is pure Rust; the cbc feature uses COIN-OR CBC (faster on large problems, needs the system CBC library). Resilience never needs a solver.

Re-exports§

pub use distribution::Distribution;
pub use error::Error;
pub use expr::choose;
pub use expr::majority;
pub use expr::And;
pub use expr::Choose;
pub use expr::Element;
pub use expr::Expr;
pub use expr::Node;
pub use expr::Or;
pub use quorum_system::Objective;
pub use quorum_system::Quorum;
pub use quorum_system::QuorumSystem;
pub use quorum_system::Strategy;
pub use quorum_system::StrategyLimits;
pub use search::search;
pub use search::SearchConfig;
pub use search::SearchResult;
pub use hashbrown;

Modules§

distribution
Workload distribution types for modeling read/write ratios.
error
Error types for the Quoracle library
expr
Expression algebra for defining quorum systems.
geometry
Geometric types for piecewise linear functions.
quorum_system
Read-write quorum systems and strategies.
search
Heuristic search for good quorum systems.