Skip to content

Commit

Permalink
refactor(531): Label transaction count metric with boolean flag (#532)
Browse files Browse the repository at this point in the history
Fixes #531.

Instead of having two distinct metrics for commits and rollbacks,
this patch replaces them with a single metric plus a boolean label
representing whether the transaction was committed or rolled back.
  • Loading branch information
joshua-spacetime authored Nov 7, 2023
1 parent 250115b commit ecebf3d
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 17 deletions.
22 changes: 14 additions & 8 deletions crates/core/src/db/datastore/locking_tx_datastore/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2115,39 +2115,45 @@ impl traits::MutTx for Locking {
}

fn rollback_mut_tx(&self, ctx: &ExecutionContext, mut tx: Self::MutTxId) {
let txn_type = &ctx.txn_type();
let db = &ctx.database();
let reducer = ctx.reducer_name().unwrap_or_default();
let elapsed_time = tx.timer.elapsed();
let cpu_time = elapsed_time - tx.lock_wait_time;
DB_METRICS
.rdb_num_txns_rolledback
.with_label_values(&ctx.txn_type(), &ctx.database(), ctx.reducer_name().unwrap_or(""))
.rdb_num_txns
.with_label_values(txn_type, db, reducer, &false)
.inc();
DB_METRICS
.rdb_txn_cpu_time_sec
.with_label_values(&ctx.txn_type(), &ctx.database(), ctx.reducer_name().unwrap_or(""))
.with_label_values(txn_type, db, reducer)
.observe(cpu_time.as_secs_f64());
DB_METRICS
.rdb_txn_elapsed_time_sec
.with_label_values(&ctx.txn_type(), &ctx.database(), ctx.reducer_name().unwrap_or(""))
.with_label_values(txn_type, db, reducer)
.observe(elapsed_time.as_secs_f64());
tx.lock.rollback();
}

fn commit_mut_tx(&self, ctx: &ExecutionContext, mut tx: Self::MutTxId) -> super::Result<Option<TxData>> {
let txn_type = &ctx.txn_type();
let db = &ctx.database();
let reducer = ctx.reducer_name().unwrap_or_default();
let elapsed_time = tx.timer.elapsed();
let cpu_time = elapsed_time - tx.lock_wait_time;
// Note, we record empty transactions in our metrics.
// That is, transactions that don't write any rows to the commit log.
DB_METRICS
.rdb_num_txns_committed
.with_label_values(&ctx.txn_type(), &ctx.database(), ctx.reducer_name().unwrap_or(""))
.rdb_num_txns
.with_label_values(txn_type, db, reducer, &true)
.inc();
DB_METRICS
.rdb_txn_cpu_time_sec
.with_label_values(&ctx.txn_type(), &ctx.database(), ctx.reducer_name().unwrap_or(""))
.with_label_values(txn_type, db, reducer)
.observe(cpu_time.as_secs_f64());
DB_METRICS
.rdb_txn_elapsed_time_sec
.with_label_values(&ctx.txn_type(), &ctx.database(), ctx.reducer_name().unwrap_or(""))
.with_label_values(txn_type, db, reducer)
.observe(elapsed_time.as_secs_f64());
tx.lock.commit()
}
Expand Down
13 changes: 4 additions & 9 deletions crates/core/src/db/db_metrics/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,15 +86,10 @@ metrics_group!(
#[labels(txn_type: TransactionType, db: Address, reducer: str, table_id: u32)]
pub rdb_num_index_seeks: IntCounterVec,

#[name = spacetime_num_txns_committed_cumulative]
#[help = "The cumulative number of committed transactions"]
#[labels(txn_type: TransactionType, db: Address, reducer: str)]
pub rdb_num_txns_committed: IntCounterVec,

#[name = spacetime_num_txns_rolledback_cumulative]
#[help = "The cumulative number of rolled back transactions"]
#[labels(txn_type: TransactionType, db: Address, reducer: str)]
pub rdb_num_txns_rolledback: IntCounterVec,
#[name = spacetime_num_txns_cumulative]
#[help = "The cumulative number of transactions, including both commits and rollbacks"]
#[labels(txn_type: TransactionType, db: Address, reducer: str, committed: bool)]
pub rdb_num_txns: IntCounterVec,

#[name = spacetime_txn_elapsed_time_sec]
#[help = "The total elapsed (wall) time of a transaction (in seconds)"]
Expand Down
1 change: 1 addition & 0 deletions crates/core/src/util/typed_prometheus.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ impl_prometheusvalue_string!(
Address,
TransactionType,
AbiCall,
bool,
u8,
u16,
u32,
Expand Down

1 comment on commit ecebf3d

@github-actions
Copy link

@github-actions github-actions bot commented on ecebf3d Nov 7, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Benchmark results

Benchmark Report

Legend:

  • load: number of rows pre-loaded into the database
  • count: number of rows touched by the transaction
  • index types:
    • unique: a single index on the id column
    • non_unique: no indexes
    • multi_index: non-unique index on every column
  • schemas:
    • person(id: u32, name: String, age: u64)
    • location(id: u32, x: u64, y: u64)

All throughputs are single-threaded.

Empty transaction

db on disk new latency old latency new throughput old throughput
sqlite 💿 434.7±3.41ns 437.6±1.37ns - -
sqlite 🧠 429.8±2.47ns 425.7±1.25ns - -
stdb_module 💿 17.6±1.21µs 17.6±1.00µs - -
stdb_module 🧠 18.1±1.11µs 18.8±1.46µs - -
stdb_raw 💿 719.7±1.54ns 712.5±1.72ns - -
stdb_raw 🧠 714.1±1.03ns 710.9±2.41ns - -

Single-row insertions

db on disk schema index type load new latency old latency new throughput old throughput
sqlite 💿 location multi_index 0 14.5±0.04µs 14.6±0.77µs 67.4 Ktx/sec 66.7 Ktx/sec
sqlite 💿 location multi_index 1000 15.9±0.15µs 15.9±0.10µs 61.3 Ktx/sec 61.6 Ktx/sec
sqlite 💿 location non_unique 0 7.2±0.37µs 7.4±0.54µs 134.9 Ktx/sec 131.9 Ktx/sec
sqlite 💿 location non_unique 1000 7.1±0.03µs 7.0±0.04µs 137.0 Ktx/sec 138.6 Ktx/sec
sqlite 💿 location unique 0 7.2±0.32µs 7.6±0.35µs 135.8 Ktx/sec 127.8 Ktx/sec
sqlite 💿 location unique 1000 7.2±0.08µs 7.1±0.05µs 136.0 Ktx/sec 138.3 Ktx/sec
sqlite 💿 person multi_index 0 14.8±1.36µs 14.5±0.06µs 65.9 Ktx/sec 67.4 Ktx/sec
sqlite 💿 person multi_index 1000 16.2±0.19µs 16.3±0.11µs 60.2 Ktx/sec 60.0 Ktx/sec
sqlite 💿 person non_unique 0 7.3±0.04µs 7.5±0.12µs 132.9 Ktx/sec 131.1 Ktx/sec
sqlite 💿 person non_unique 1000 7.4±0.05µs 7.3±0.04µs 132.1 Ktx/sec 133.4 Ktx/sec
sqlite 💿 person unique 0 7.3±0.04µs 7.4±0.04µs 133.5 Ktx/sec 132.0 Ktx/sec
sqlite 💿 person unique 1000 7.4±0.05µs 7.3±0.04µs 132.3 Ktx/sec 133.8 Ktx/sec
sqlite 🧠 location multi_index 0 4.0±0.01µs 4.0±0.15µs 244.1 Ktx/sec 242.4 Ktx/sec
sqlite 🧠 location multi_index 1000 5.2±0.02µs 5.1±0.03µs 187.6 Ktx/sec 190.7 Ktx/sec
sqlite 🧠 location non_unique 0 1826.8±8.70ns 1859.5±5.94ns 534.6 Ktx/sec 525.2 Ktx/sec
sqlite 🧠 location non_unique 1000 1914.9±36.13ns 1938.7±7.71ns 510.0 Ktx/sec 503.7 Ktx/sec
sqlite 🧠 location unique 0 1820.0±8.36ns 1850.6±6.20ns 536.6 Ktx/sec 527.7 Ktx/sec
sqlite 🧠 location unique 1000 1921.9±19.63ns 1959.4±10.97ns 508.1 Ktx/sec 498.4 Ktx/sec
sqlite 🧠 person multi_index 0 3.6±0.01µs 3.7±0.01µs 268.7 Ktx/sec 266.4 Ktx/sec
sqlite 🧠 person multi_index 1000 5.3±0.03µs 5.5±0.05µs 184.1 Ktx/sec 179.1 Ktx/sec
sqlite 🧠 person non_unique 0 1903.1±7.60ns 1932.8±4.68ns 513.1 Ktx/sec 505.3 Ktx/sec
sqlite 🧠 person non_unique 1000 2.0±0.01µs 2.0±0.02µs 485.2 Ktx/sec 481.3 Ktx/sec
sqlite 🧠 person unique 0 1882.3±18.07ns 1917.9±4.85ns 518.8 Ktx/sec 509.2 Ktx/sec
sqlite 🧠 person unique 1000 2.0±0.03µs 2.1±0.02µs 483.5 Ktx/sec 473.0 Ktx/sec
stdb_module 💿 location multi_index 0 51.9±4.39µs 53.3±6.23µs 18.8 Ktx/sec 18.3 Ktx/sec
stdb_module 💿 location multi_index 1000 139.1±20.02µs 110.0±7.12µs 7.0 Ktx/sec 8.9 Ktx/sec
stdb_module 💿 location non_unique 0 44.8±3.80µs 48.0±4.34µs 21.8 Ktx/sec 20.3 Ktx/sec
stdb_module 💿 location non_unique 1000 100.0±17.70µs 237.1±82.28µs 9.8 Ktx/sec 4.1 Ktx/sec
stdb_module 💿 location unique 0 53.4±4.52µs 49.1±5.33µs 18.3 Ktx/sec 19.9 Ktx/sec
stdb_module 💿 location unique 1000 148.2±9.34µs 108.2±63.95µs 6.6 Ktx/sec 9.0 Ktx/sec
stdb_module 💿 person multi_index 0 63.6±4.70µs 66.7±6.00µs 15.4 Ktx/sec 14.6 Ktx/sec
stdb_module 💿 person multi_index 1000 262.6±49.62µs 164.5±19.63µs 3.7 Ktx/sec 5.9 Ktx/sec
stdb_module 💿 person non_unique 0 48.3±5.46µs 48.8±4.31µs 20.2 Ktx/sec 20.0 Ktx/sec
stdb_module 💿 person non_unique 1000 198.6±101.13µs 196.5±18.31µs 4.9 Ktx/sec 5.0 Ktx/sec
stdb_module 💿 person unique 0 52.9±5.69µs 56.5±6.17µs 18.4 Ktx/sec 17.3 Ktx/sec
stdb_module 💿 person unique 1000 322.3±14.40µs 118.1±56.85µs 3.0 Ktx/sec 8.3 Ktx/sec
stdb_module 🧠 location multi_index 0 38.8±4.02µs 34.9±2.84µs 25.2 Ktx/sec 28.0 Ktx/sec
stdb_module 🧠 location multi_index 1000 120.3±9.64µs 137.1±10.16µs 8.1 Ktx/sec 7.1 Ktx/sec
stdb_module 🧠 location non_unique 0 29.7±1.77µs 34.1±3.46µs 32.9 Ktx/sec 28.6 Ktx/sec
stdb_module 🧠 location non_unique 1000 106.4±1.47µs 186.6±7.31µs 9.2 Ktx/sec 5.2 Ktx/sec
stdb_module 🧠 location unique 0 36.0±3.40µs 33.4±2.83µs 27.2 Ktx/sec 29.3 Ktx/sec
stdb_module 🧠 location unique 1000 163.5±5.20µs 105.9±11.74µs 6.0 Ktx/sec 9.2 Ktx/sec
stdb_module 🧠 person multi_index 0 46.2±4.63µs 49.4±4.96µs 21.1 Ktx/sec 19.7 Ktx/sec
stdb_module 🧠 person multi_index 1000 163.9±19.46µs 254.5±2.93µs 6.0 Ktx/sec 3.8 Ktx/sec
stdb_module 🧠 person non_unique 0 34.5±4.84µs 32.5±3.23µs 28.3 Ktx/sec 30.0 Ktx/sec
stdb_module 🧠 person non_unique 1000 293.0±7.97µs 314.7±4.54µs 3.3 Ktx/sec 3.1 Ktx/sec
stdb_module 🧠 person unique 0 35.6±3.90µs 40.4±4.84µs 27.4 Ktx/sec 24.2 Ktx/sec
stdb_module 🧠 person unique 1000 203.8±5.05µs 228.6±18.89µs 4.8 Ktx/sec 4.3 Ktx/sec
stdb_raw 💿 location multi_index 0 7.3±0.39µs 7.3±0.02µs 134.3 Ktx/sec 134.6 Ktx/sec
stdb_raw 💿 location multi_index 1000 9.9±0.15µs 33.6±236.37µs 98.2 Ktx/sec 29.1 Ktx/sec
stdb_raw 💿 location non_unique 0 4.8±0.01µs 4.9±0.01µs 202.1 Ktx/sec 200.9 Ktx/sec
stdb_raw 💿 location non_unique 1000 17.0±107.27µs 16.9±105.65µs 57.3 Ktx/sec 57.8 Ktx/sec
stdb_raw 💿 location unique 0 6.2±0.31µs 6.3±0.27µs 157.0 Ktx/sec 155.7 Ktx/sec
stdb_raw 💿 location unique 1000 26.4±178.23µs 26.2±177.03µs 37.0 Ktx/sec 37.2 Ktx/sec
stdb_raw 💿 person multi_index 0 11.0±0.03µs 11.0±0.44µs 88.7 Ktx/sec 88.4 Ktx/sec
stdb_raw 💿 person multi_index 1000 50.0±356.98µs 14.3±0.24µs 19.5 Ktx/sec 68.5 Ktx/sec
stdb_raw 💿 person non_unique 0 5.4±0.02µs 5.5±0.05µs 181.0 Ktx/sec 177.8 Ktx/sec
stdb_raw 💿 person non_unique 1000 7.1±0.13µs 7.2±0.75µs 138.0 Ktx/sec 135.4 Ktx/sec
stdb_raw 💿 person unique 0 7.8±0.39µs 7.9±0.04µs 124.5 Ktx/sec 124.0 Ktx/sec
stdb_raw 💿 person unique 1000 34.2±236.83µs 10.3±0.15µs 28.6 Ktx/sec 94.8 Ktx/sec
stdb_raw 🧠 location multi_index 0 4.2±0.01µs 4.2±0.01µs 231.1 Ktx/sec 233.6 Ktx/sec
stdb_raw 🧠 location multi_index 1000 5.8±0.04µs 5.7±0.04µs 169.2 Ktx/sec 171.0 Ktx/sec
stdb_raw 🧠 location non_unique 0 1970.7±5.94ns 1931.7±9.26ns 495.5 Ktx/sec 505.5 Ktx/sec
stdb_raw 🧠 location non_unique 1000 2.5±0.02µs 2.4±0.01µs 397.3 Ktx/sec 402.1 Ktx/sec
stdb_raw 🧠 location unique 0 3.2±0.01µs 3.1±0.01µs 307.0 Ktx/sec 310.8 Ktx/sec
stdb_raw 🧠 location unique 1000 4.3±0.06µs 4.5±0.02µs 227.8 Ktx/sec 218.7 Ktx/sec
stdb_raw 🧠 person multi_index 0 7.9±0.06µs 7.8±0.01µs 123.7 Ktx/sec 124.8 Ktx/sec
stdb_raw 🧠 person multi_index 1000 10.0±0.07µs 9.8±0.08µs 97.6 Ktx/sec 99.4 Ktx/sec
stdb_raw 🧠 person non_unique 0 2.5±0.01µs 2.5±0.01µs 387.8 Ktx/sec 393.1 Ktx/sec
stdb_raw 🧠 person non_unique 1000 3.2±0.02µs 3.2±0.02µs 307.7 Ktx/sec 308.9 Ktx/sec
stdb_raw 🧠 person unique 0 4.8±0.02µs 4.7±0.01µs 205.2 Ktx/sec 205.8 Ktx/sec
stdb_raw 🧠 person unique 1000 6.3±0.03µs 6.2±0.03µs 153.9 Ktx/sec 156.8 Ktx/sec

Multi-row insertions

db on disk schema index type load count new latency old latency new throughput old throughput
sqlite 💿 location multi_index 0 100 132.3±1.82µs 131.3±3.53µs 7.4 Ktx/sec 7.4 Ktx/sec
sqlite 💿 location multi_index 1000 100 209.1±63.28µs 203.1±1.65µs 4.7 Ktx/sec 4.8 Ktx/sec
sqlite 💿 location non_unique 0 100 51.2±1.77µs 48.9±1.16µs 19.1 Ktx/sec 20.0 Ktx/sec
sqlite 💿 location non_unique 1000 100 53.0±0.38µs 51.8±0.30µs 18.4 Ktx/sec 18.9 Ktx/sec
sqlite 💿 location unique 0 100 52.3±1.53µs 50.1±0.38µs 18.7 Ktx/sec 19.5 Ktx/sec
sqlite 💿 location unique 1000 100 56.0±0.23µs 56.3±0.49µs 17.4 Ktx/sec 17.4 Ktx/sec
sqlite 💿 person multi_index 0 100 120.7±4.03µs 118.0±2.29µs 8.1 Ktx/sec 8.3 Ktx/sec
sqlite 💿 person multi_index 1000 100 232.3±0.45µs 235.0±2.06µs 4.2 Ktx/sec 4.2 Ktx/sec
sqlite 💿 person non_unique 0 100 50.4±1.38µs 48.3±4.87µs 19.4 Ktx/sec 20.2 Ktx/sec
sqlite 💿 person non_unique 1000 100 62.2±0.37µs 58.5±0.19µs 15.7 Ktx/sec 16.7 Ktx/sec
sqlite 💿 person unique 0 100 50.9±0.41µs 49.5±2.99µs 19.2 Ktx/sec 19.7 Ktx/sec
sqlite 💿 person unique 1000 100 56.5±0.33µs 55.1±8.97µs 17.3 Ktx/sec 17.7 Ktx/sec
sqlite 🧠 location multi_index 0 100 119.7±0.62µs 119.0±0.39µs 8.2 Ktx/sec 8.2 Ktx/sec
sqlite 🧠 location multi_index 1000 100 170.7±0.52µs 170.9±0.35µs 5.7 Ktx/sec 5.7 Ktx/sec
sqlite 🧠 location non_unique 0 100 44.7±0.32µs 42.7±0.45µs 21.9 Ktx/sec 22.9 Ktx/sec
sqlite 🧠 location non_unique 1000 100 45.4±0.44µs 44.2±0.39µs 21.5 Ktx/sec 22.1 Ktx/sec
sqlite 🧠 location unique 0 100 46.2±0.24µs 44.7±0.43µs 21.1 Ktx/sec 21.9 Ktx/sec
sqlite 🧠 location unique 1000 100 49.5±0.40µs 47.5±0.48µs 19.7 Ktx/sec 20.5 Ktx/sec
sqlite 🧠 person multi_index 0 100 109.1±0.39µs 105.8±0.42µs 8.9 Ktx/sec 9.2 Ktx/sec
sqlite 🧠 person multi_index 1000 100 189.7±0.60µs 189.5±0.30µs 5.1 Ktx/sec 5.2 Ktx/sec
sqlite 🧠 person non_unique 0 100 43.8±0.44µs 41.5±0.30µs 22.3 Ktx/sec 23.5 Ktx/sec
sqlite 🧠 person non_unique 1000 100 46.9±0.45µs 44.4±0.20µs 20.8 Ktx/sec 22.0 Ktx/sec
sqlite 🧠 person unique 0 100 44.4±0.38µs 42.0±0.43µs 22.0 Ktx/sec 23.2 Ktx/sec
sqlite 🧠 person unique 1000 100 49.2±0.41µs 46.4±0.35µs 19.9 Ktx/sec 21.1 Ktx/sec
stdb_module 💿 location multi_index 0 100 656.1±1.59µs 772.1±200.62µs 1524 tx/sec 1295 tx/sec
stdb_module 💿 location multi_index 1000 100 1206.5±44.46µs 847.9±27.50µs 828 tx/sec 1179 tx/sec
stdb_module 💿 location non_unique 0 100 608.3±55.42µs 630.8±1.91µs 1644 tx/sec 1585 tx/sec
stdb_module 💿 location non_unique 1000 100 768.5±85.48µs 522.3±47.20µs 1301 tx/sec 1914 tx/sec
stdb_module 💿 location unique 0 100 561.3±106.72µs 621.1±84.58µs 1781 tx/sec 1609 tx/sec
stdb_module 💿 location unique 1000 100 694.7±55.60µs 576.7±10.10µs 1439 tx/sec 1733 tx/sec
stdb_module 💿 person multi_index 0 100 985.6±99.20µs 1152.2±134.65µs 1014 tx/sec 867 tx/sec
stdb_module 💿 person multi_index 1000 100 1041.4±2.21µs 1298.9±58.57µs 960 tx/sec 769 tx/sec
stdb_module 💿 person non_unique 0 100 638.5±71.04µs 764.6±8.33µs 1566 tx/sec 1307 tx/sec
stdb_module 💿 person non_unique 1000 100 792.8±15.20µs 1024.7±156.53µs 1261 tx/sec 975 tx/sec
stdb_module 💿 person unique 0 100 782.2±4.43µs 706.8±85.93µs 1278 tx/sec 1414 tx/sec
stdb_module 💿 person unique 1000 100 958.4±46.73µs 1182.1±89.23µs 1043 tx/sec 845 tx/sec
stdb_module 🧠 location multi_index 0 100 638.6±61.90µs 653.7±124.25µs 1565 tx/sec 1529 tx/sec
stdb_module 🧠 location multi_index 1000 100 691.5±26.43µs 879.7±75.92µs 1446 tx/sec 1136 tx/sec
stdb_module 🧠 location non_unique 0 100 330.7±5.67µs 381.9±20.51µs 3.0 Ktx/sec 2.6 Ktx/sec
stdb_module 🧠 location non_unique 1000 100 392.0±32.46µs 439.3±28.87µs 2.5 Ktx/sec 2.2 Ktx/sec
stdb_module 🧠 location unique 0 100 356.2±29.74µs 419.9±4.49µs 2.7 Ktx/sec 2.3 Ktx/sec
stdb_module 🧠 location unique 1000 100 601.4±8.22µs 453.5±63.69µs 1662 tx/sec 2.2 Ktx/sec
stdb_module 🧠 person multi_index 0 100 947.5±11.62µs 816.8±1.75µs 1055 tx/sec 1224 tx/sec
stdb_module 🧠 person multi_index 1000 100 1060.9±33.09µs 916.0±30.84µs 942 tx/sec 1091 tx/sec
stdb_module 🧠 person non_unique 0 100 313.6±7.67µs 408.7±1.31µs 3.1 Ktx/sec 2.4 Ktx/sec
stdb_module 🧠 person non_unique 1000 100 421.6±49.13µs 532.0±9.21µs 2.3 Ktx/sec 1879 tx/sec
stdb_module 🧠 person unique 0 100 588.6±22.56µs 637.7±1.80µs 1699 tx/sec 1568 tx/sec
stdb_module 🧠 person unique 1000 100 732.5±47.32µs 827.6±11.07µs 1365 tx/sec 1208 tx/sec
stdb_raw 💿 location multi_index 0 100 394.8±1.31µs 400.0±12.34µs 2.5 Ktx/sec 2.4 Ktx/sec
stdb_raw 💿 location multi_index 1000 100 446.2±261.08µs 445.0±206.07µs 2.2 Ktx/sec 2.2 Ktx/sec
stdb_raw 💿 location non_unique 0 100 172.4±0.29µs 170.3±0.20µs 5.7 Ktx/sec 5.7 Ktx/sec
stdb_raw 💿 location non_unique 1000 100 175.1±1.03µs 172.6±1.02µs 5.6 Ktx/sec 5.7 Ktx/sec
stdb_raw 💿 location unique 0 100 294.6±0.57µs 296.8±0.59µs 3.3 Ktx/sec 3.3 Ktx/sec
stdb_raw 💿 location unique 1000 100 331.1±190.91µs 317.4±1.24µs 2.9 Ktx/sec 3.1 Ktx/sec
stdb_raw 💿 person multi_index 0 100 720.1±5.57µs 724.8±1.54µs 1388 tx/sec 1379 tx/sec
stdb_raw 💿 person multi_index 1000 100 789.3±409.93µs 792.7±387.37µs 1266 tx/sec 1261 tx/sec
stdb_raw 💿 person non_unique 0 100 228.8±4.82µs 227.0±2.19µs 4.3 Ktx/sec 4.3 Ktx/sec
stdb_raw 💿 person non_unique 1000 100 230.6±0.51µs 230.1±0.53µs 4.2 Ktx/sec 4.2 Ktx/sec
stdb_raw 💿 person unique 0 100 436.8±4.36µs 440.6±1.42µs 2.2 Ktx/sec 2.2 Ktx/sec
stdb_raw 💿 person unique 1000 100 480.4±265.95µs 484.7±259.61µs 2.0 Ktx/sec 2.0 Ktx/sec
stdb_raw 🧠 location multi_index 0 100 298.0±1.07µs 304.0±2.59µs 3.3 Ktx/sec 3.2 Ktx/sec
stdb_raw 🧠 location multi_index 1000 100 320.6±0.42µs 329.3±0.56µs 3.0 Ktx/sec 3.0 Ktx/sec
stdb_raw 🧠 location non_unique 0 100 76.4±0.13µs 73.9±0.14µs 12.8 Ktx/sec 13.2 Ktx/sec
stdb_raw 🧠 location non_unique 1000 100 77.1±0.16µs 74.9±0.34µs 12.7 Ktx/sec 13.0 Ktx/sec
stdb_raw 🧠 location unique 0 100 198.2±0.24µs 201.2±0.28µs 4.9 Ktx/sec 4.9 Ktx/sec
stdb_raw 🧠 location unique 1000 100 214.4±0.26µs 219.9±0.42µs 4.6 Ktx/sec 4.4 Ktx/sec
stdb_raw 🧠 person multi_index 0 100 616.6±0.46µs 621.5±0.77µs 1621 tx/sec 1609 tx/sec
stdb_raw 🧠 person multi_index 1000 100 645.4±0.81µs 651.6±0.68µs 1549 tx/sec 1534 tx/sec
stdb_raw 🧠 person non_unique 0 100 126.7±0.16µs 125.9±0.36µs 7.7 Ktx/sec 7.8 Ktx/sec
stdb_raw 🧠 person non_unique 1000 100 129.4±0.40µs 128.5±0.33µs 7.5 Ktx/sec 7.6 Ktx/sec
stdb_raw 🧠 person unique 0 100 333.7±0.30µs 337.3±0.34µs 2.9 Ktx/sec 2.9 Ktx/sec
stdb_raw 🧠 person unique 1000 100 352.2±0.29µs 357.7±0.62µs 2.8 Ktx/sec 2.7 Ktx/sec

Full table iterate

db on disk schema index type new latency old latency new throughput old throughput
sqlite 💿 location unique 8.9±0.08µs 8.9±0.15µs 109.2 Ktx/sec 109.5 Ktx/sec
sqlite 💿 person unique 9.5±0.18µs 9.4±0.08µs 103.2 Ktx/sec 104.4 Ktx/sec
sqlite 🧠 location unique 7.9±0.10µs 7.8±0.15µs 124.2 Ktx/sec 125.8 Ktx/sec
sqlite 🧠 person unique 8.3±0.12µs 8.1±0.08µs 118.4 Ktx/sec 121.0 Ktx/sec
stdb_module 💿 location unique 51.5±5.00µs 43.9±8.88µs 19.0 Ktx/sec 22.3 Ktx/sec
stdb_module 💿 person unique 66.0±8.04µs 57.9±11.27µs 14.8 Ktx/sec 16.9 Ktx/sec
stdb_module 🧠 location unique 51.9±4.74µs 48.1±4.79µs 18.8 Ktx/sec 20.3 Ktx/sec
stdb_module 🧠 person unique 61.4±10.99µs 60.0±10.59µs 15.9 Ktx/sec 16.3 Ktx/sec
stdb_raw 💿 location unique 11.6±0.01µs 9.1±0.01µs 84.5 Ktx/sec 107.1 Ktx/sec
stdb_raw 💿 person unique 11.6±0.12µs 9.2±0.43µs 84.3 Ktx/sec 105.9 Ktx/sec
stdb_raw 🧠 location unique 11.6±0.09µs 9.1±0.03µs 84.5 Ktx/sec 107.0 Ktx/sec
stdb_raw 🧠 person unique 11.5±0.02µs 9.1±0.01µs 84.6 Ktx/sec 107.1 Ktx/sec

Find unique key

db on disk key type load new latency old latency new throughput old throughput
sqlite 💿 u32 1000 2.3±0.01µs 2.4±0.02µs 416.7 Ktx/sec 410.6 Ktx/sec
sqlite 🧠 u32 1000 1127.9±4.29ns 1136.3±16.45ns 865.9 Ktx/sec 859.4 Ktx/sec
stdb_module 💿 u32 1000 24.6±1.62µs 25.1±2.05µs 39.8 Ktx/sec 39.0 Ktx/sec
stdb_module 🧠 u32 1000 25.1±2.26µs 23.9±1.18µs 38.9 Ktx/sec 40.9 Ktx/sec
stdb_raw 💿 u32 1000 1938.0±4.63ns 1920.0±15.26ns 503.9 Ktx/sec 508.6 Ktx/sec
stdb_raw 🧠 u32 1000 1926.5±14.38ns 1906.7±3.60ns 506.9 Ktx/sec 512.2 Ktx/sec

Filter

db on disk key type index strategy load count new latency old latency new throughput old throughput
sqlite 💿 string indexed 1000 10 5.7±0.03µs 5.6±0.02µs 172.8 Ktx/sec 174.5 Ktx/sec
sqlite 💿 string non_indexed 1000 10 55.3±0.76µs 49.3±0.25µs 17.7 Ktx/sec 19.8 Ktx/sec
sqlite 💿 u64 indexed 1000 10 5.4±0.01µs 5.4±0.01µs 181.2 Ktx/sec 180.2 Ktx/sec
sqlite 💿 u64 non_indexed 1000 10 34.5±0.17µs 33.2±0.39µs 28.3 Ktx/sec 29.4 Ktx/sec
sqlite 🧠 string indexed 1000 10 4.2±0.01µs 4.1±0.02µs 229.9 Ktx/sec 235.7 Ktx/sec
sqlite 🧠 string non_indexed 1000 10 54.3±0.27µs 47.9±0.26µs 18.0 Ktx/sec 20.4 Ktx/sec
sqlite 🧠 u64 indexed 1000 10 4.0±0.01µs 4.0±0.02µs 244.4 Ktx/sec 245.5 Ktx/sec
sqlite 🧠 u64 non_indexed 1000 10 33.3±0.06µs 32.0±0.09µs 29.4 Ktx/sec 30.6 Ktx/sec
stdb_module 💿 string indexed 1000 10 35.7±2.50µs 35.3±3.47µs 27.4 Ktx/sec 27.7 Ktx/sec
stdb_module 💿 string non_indexed 1000 10 183.0±3.41µs 175.4±6.47µs 5.3 Ktx/sec 5.6 Ktx/sec
stdb_module 💿 u64 indexed 1000 10 32.3±2.19µs 33.4±2.09µs 30.3 Ktx/sec 29.3 Ktx/sec
stdb_module 💿 u64 non_indexed 1000 10 157.0±1.46µs 147.8±23.29µs 6.2 Ktx/sec 6.6 Ktx/sec
stdb_module 🧠 string indexed 1000 10 35.0±2.12µs 37.0±2.61µs 27.9 Ktx/sec 26.4 Ktx/sec
stdb_module 🧠 string non_indexed 1000 10 181.7±3.00µs 163.0±2.12µs 5.4 Ktx/sec 6.0 Ktx/sec
stdb_module 🧠 u64 indexed 1000 10 32.2±2.23µs 31.2±3.21µs 30.3 Ktx/sec 31.3 Ktx/sec
stdb_module 🧠 u64 non_indexed 1000 10 149.6±3.18µs 134.2±6.87µs 6.5 Ktx/sec 7.3 Ktx/sec
stdb_raw 💿 string indexed 1000 10 4.5±0.01µs 4.4±0.05µs 217.3 Ktx/sec 220.0 Ktx/sec
stdb_raw 💿 string non_indexed 1000 10 155.5±0.81µs 139.4±0.56µs 6.3 Ktx/sec 7.0 Ktx/sec
stdb_raw 💿 u64 indexed 1000 10 4.4±0.01µs 4.3±0.01µs 222.6 Ktx/sec 228.8 Ktx/sec
stdb_raw 💿 u64 non_indexed 1000 10 130.0±0.17µs 117.5±1.47µs 7.5 Ktx/sec 8.3 Ktx/sec
stdb_raw 🧠 string indexed 1000 10 4.5±0.01µs 4.4±0.01µs 217.4 Ktx/sec 221.2 Ktx/sec
stdb_raw 🧠 string non_indexed 1000 10 153.1±0.42µs 136.5±0.42µs 6.4 Ktx/sec 7.2 Ktx/sec
stdb_raw 🧠 u64 indexed 1000 10 4.4±0.01µs 4.3±0.01µs 223.4 Ktx/sec 229.0 Ktx/sec
stdb_raw 🧠 u64 non_indexed 1000 10 130.2±0.19µs 117.0±0.39µs 7.5 Ktx/sec 8.4 Ktx/sec

Serialize

schema format count new latency old latency new throughput old throughput
location bsatn 100 1649.7±30.50ns 1789.4±32.68ns 57.8 Mtx/sec 53.3 Mtx/sec
location json 100 3.4±0.03µs 3.1±0.00µs 28.1 Mtx/sec 30.5 Mtx/sec
location product_value 100 547.4±2.06ns 572.3±0.99ns 174.2 Mtx/sec 166.6 Mtx/sec
person bsatn 100 3.0±0.02µs 2.5±0.02µs 31.5 Mtx/sec 37.4 Mtx/sec
person json 100 5.2±0.04µs 4.8±0.03µs 18.5 Mtx/sec 19.8 Mtx/sec
person product_value 100 1037.3±0.60ns 1028.5±1.36ns 91.9 Mtx/sec 92.7 Mtx/sec

Module: invoke with large arguments

arg size new latency old latency new throughput old throughput
64KiB 79.6±4.73µs 79.9±3.92µs - -

Module: print bulk

line count new latency old latency new throughput old throughput
1 22.0±1.13µs 22.6±1.63µs - -
100 199.3±1.27µs 197.1±1.43µs - -
1000 1890.8±218.22µs 1840.7±70.11µs - -

Remaining benchmarks

name new latency old latency new throughput old throughput

Please sign in to comment.