-
Notifications
You must be signed in to change notification settings - Fork 109
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b9bfe2c
commit ac24ff0
Showing
20 changed files
with
364 additions
and
483 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,119 +1,55 @@ | ||
use crate::util::typed_prometheus::metrics_group; | ||
use once_cell::sync::Lazy; | ||
use prometheus::{Histogram, HistogramOpts, HistogramVec, Registry}; | ||
use prometheus::{Histogram, HistogramVec}; | ||
|
||
#[non_exhaustive] | ||
pub struct DbMetrics { | ||
pub registry: Registry, | ||
pub tdb_insert_time: Histogram, | ||
pub tdb_delete_time: Histogram, | ||
pub tdb_seek_time: Histogram, | ||
pub tdb_scan_time: Histogram, | ||
pub tdb_commit_time: Histogram, | ||
pub rdb_create_table_time: HistogramVec, | ||
pub rdb_drop_table_time: HistogramVec, | ||
pub rdb_iter_time: HistogramVec, | ||
pub rdb_insert_row_time: HistogramVec, | ||
pub rdb_delete_by_rel_time: HistogramVec, | ||
} | ||
metrics_group!( | ||
#[non_exhaustive] | ||
pub struct DbMetrics { | ||
#[name = spacetime_tdb_insert_time] | ||
#[help = "Time time it takes for the transactional store to perform an insert"] | ||
pub tdb_insert_time: Histogram, | ||
|
||
pub static DB_METRICS: Lazy<DbMetrics> = Lazy::new(DbMetrics::new); | ||
#[name = spacetime_tdb_delete_time] | ||
#[help = "Time time it takes for the transactional store to perform a delete"] | ||
pub tdb_delete_time: Histogram, | ||
|
||
impl DbMetrics { | ||
fn new() -> Self { | ||
DbMetrics { | ||
registry: Registry::new(), | ||
tdb_insert_time: Histogram::with_opts(HistogramOpts::new( | ||
"spacetime_tdb_insert_time", | ||
"Time time it takes for the transactional store to perform an insert", | ||
)) | ||
.unwrap(), | ||
tdb_delete_time: Histogram::with_opts(HistogramOpts::new( | ||
"spacetime_tdb_delete_time", | ||
"Time time it takes for the transactional store to perform a delete", | ||
)) | ||
.unwrap(), | ||
tdb_seek_time: Histogram::with_opts(HistogramOpts::new( | ||
"spacetime_tdb_seek_time", | ||
"Time time it takes for the transactional store to perform a seek", | ||
)) | ||
.unwrap(), | ||
tdb_scan_time: Histogram::with_opts(HistogramOpts::new( | ||
"spacetime_tdb_scan_time", | ||
"Time time it takes for the transactional store to perform a scan", | ||
)) | ||
.unwrap(), | ||
tdb_commit_time: Histogram::with_opts(HistogramOpts::new( | ||
"spacetime_tdb_commit_time", | ||
"Time time it takes for the transactional store to perform a Tx commit", | ||
)) | ||
.unwrap(), | ||
rdb_create_table_time: HistogramVec::new( | ||
HistogramOpts::new("spacetime_rdb_create_table_time", "The time it takes to create a table"), | ||
&["table_name"], | ||
) | ||
.unwrap(), | ||
rdb_drop_table_time: HistogramVec::new( | ||
HistogramOpts::new("spacetime_rdb_drop_table_time", "The time spent dropping a table"), | ||
&["table_id"], | ||
) | ||
.unwrap(), | ||
rdb_iter_time: HistogramVec::new( | ||
HistogramOpts::new("spacetime_rdb_iter_time", "The time spent iterating a table"), | ||
&["table_id"], | ||
) | ||
.unwrap(), | ||
rdb_insert_row_time: HistogramVec::new( | ||
HistogramOpts::new("spacetime_rdb_insert_row_time", "The time spent inserting into a table"), | ||
&["table_id"], | ||
) | ||
.unwrap(), | ||
rdb_delete_by_rel_time: HistogramVec::new( | ||
HistogramOpts::new( | ||
"spacetime_rdb_delete_in_time", | ||
"The time spent deleting values in a set from a table", | ||
), | ||
&["table_id"], | ||
) | ||
.unwrap(), | ||
} | ||
} | ||
#[name = spacetime_tdb_seek_time] | ||
#[help = "Time time it takes for the transactional store to perform a seek"] | ||
pub tdb_seek_time: Histogram, | ||
|
||
pub fn register_custom_metrics(&self) { | ||
self.registry.register(Box::new(self.tdb_insert_time.clone())).unwrap(); | ||
self.registry.register(Box::new(self.tdb_delete_time.clone())).unwrap(); | ||
self.registry.register(Box::new(self.tdb_seek_time.clone())).unwrap(); | ||
self.registry.register(Box::new(self.tdb_scan_time.clone())).unwrap(); | ||
self.registry.register(Box::new(self.tdb_commit_time.clone())).unwrap(); | ||
#[name = spacetime_tdb_scan_time] | ||
#[help = "Time time it takes for the transactional store to perform a scan"] | ||
pub tdb_scan_time: Histogram, | ||
|
||
self.registry | ||
.register(Box::new(self.rdb_create_table_time.clone())) | ||
.unwrap(); | ||
self.registry | ||
.register(Box::new(self.rdb_drop_table_time.clone())) | ||
.unwrap(); | ||
self.registry.register(Box::new(self.rdb_iter_time.clone())).unwrap(); | ||
self.registry | ||
.register(Box::new(self.rdb_insert_row_time.clone())) | ||
.unwrap(); | ||
self.registry | ||
.register(Box::new(self.rdb_delete_by_rel_time.clone())) | ||
.unwrap(); | ||
} | ||
} | ||
#[name = spacetime_tdb_commit_time] | ||
#[help = "Time time it takes for the transactional store to perform a Tx commit"] | ||
pub tdb_commit_time: Histogram, | ||
|
||
#[name = spacetime_rdb_create_table_time] | ||
#[help = "The time it takes to create a table"] | ||
#[labels(table_name: str)] | ||
pub rdb_create_table_time: HistogramVec, | ||
|
||
#[name = spacetime_rdb_drop_table_time] | ||
#[help = "The time spent dropping a table"] | ||
#[labels(table_id: u32)] | ||
pub rdb_drop_table_time: HistogramVec, | ||
|
||
use DB_METRICS as METRICS; | ||
metrics_delegator!(REGISTRY, registry: Registry); | ||
metrics_delegator!(TDB_INSERT_TIME, tdb_insert_time: Histogram); | ||
metrics_delegator!(TDB_DELETE_TIME, tdb_delete_time: Histogram); | ||
metrics_delegator!(TDB_SEEK_TIME, tdb_seek_time: Histogram); | ||
metrics_delegator!(TDB_SCAN_TIME, tdb_scan_time: Histogram); | ||
metrics_delegator!(TDB_COMMIT_TIME, tdb_commit_time: Histogram); | ||
metrics_delegator!(RDB_CREATE_TABLE_TIME, rdb_create_table_time: HistogramVec); | ||
metrics_delegator!(RDB_DROP_TABLE_TIME, rdb_drop_table_time: HistogramVec); | ||
metrics_delegator!(RDB_ITER_TIME, rdb_iter_time: HistogramVec); | ||
metrics_delegator!(RDB_INSERT_TIME, rdb_insert_row_time: HistogramVec); | ||
metrics_delegator!(RDB_DELETE_BY_REL_TIME, rdb_delete_by_rel_time: HistogramVec); | ||
#[name = spacetime_rdb_iter_time] | ||
#[help = "The time spent iterating a table"] | ||
#[labels(table_id: u32)] | ||
pub rdb_iter_time: HistogramVec, | ||
|
||
pub fn register_custom_metrics() { | ||
DB_METRICS.register_custom_metrics() | ||
} | ||
#[name = spacetime_rdb_insert_row_time] | ||
#[help = "The time spent inserting into a table"] | ||
#[labels(table_id: u32)] | ||
pub rdb_insert_row_time: HistogramVec, | ||
|
||
#[name = spacetime_rdb_delete_in_time] | ||
#[help = "The time spent deleting values in a set from a table"] | ||
#[labels(table_id: u32)] | ||
pub rdb_delete_by_rel_time: HistogramVec, | ||
} | ||
); | ||
|
||
pub static DB_METRICS: Lazy<DbMetrics> = Lazy::new(DbMetrics::new); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
ac24ff0
There was a problem hiding this comment.
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 databasecount
: number of rows touched by the transactionunique
: a single index on theid
columnnon_unique
: no indexesmulti_index
: non-unique index on every columnperson(id: u32, name: String, age: u64)
location(id: u32, x: u64, y: u64)
All throughputs are single-threaded.
Empty transaction
Single-row insertions
Multi-row insertions
Full table iterate
Find unique key
Filter
Serialize
Module: invoke with large arguments
Module: print bulk
Remaining benchmarks