//! The store benchmark's parts that need no server (README.md): the //! server's logs and tables beside SQLite and RocksDB, under the same //! commits, at the same durability. Each prints Markdown. //! //! store-bench write every layout in turn, commits of random bytes //! store-bench spread the same of realistic commits, with binary frames and logs allocated ahead //! store-bench unsynced the same with no sync at all: the processor's ceiling, nothing durable //! store-bench scan ... logs of those sizes, replayed //! store-bench firehose [every] the events of one log for all, of SQLite, of RocksDB, and of a log for each account //! store-bench reads records read from tables, from SQLite and from RocksDB //! store-bench size what each takes on disk, and what zstd makes of a table //! store-bench ladder a record read from a table a stage at a time, to the body getRecord answers //! store-bench ladder-records those records as JSON, a line each, for ladder.mjs to write through the server //! //! Its files go under `BENCH_DIR`, by default `target/data` beside this //! crate, and are removed after: what a sync costs is that directory's //! disk's and file system's. #![forbid(unsafe_code)] mod check; mod data; mod firehose; mod fj; mod frame; mod ladder; mod reads; mod rocks; mod scan; mod size; mod stores; mod tables; mod util; mod write; fn main() { let args: Vec = std::env::args().skip(1).collect(); let numbers: Vec = args.iter().skip(1).map_while(|a| a.parse().ok()).collect(); pds_store::on_sync(write::synced); util::raise_files(); match (args.first().map(String::as_str), numbers.as_slice()) { (Some("write"), &[commits, writers]) if commits >= 10 && writers >= 1 => { write::write(commits as usize, writers as usize) } (Some("spread"), &[commits, writers, accounts]) if commits >= 10 && writers >= 1 && accounts >= 1 => { write::spread(commits as usize, writers as usize, accounts as usize) } (Some("unsynced"), &[commits, writers, accounts]) if commits >= 10 && writers >= 1 && accounts >= 1 => { write::unsynced(commits as usize, writers as usize, accounts as usize) } (Some("scan"), sizes) if !sizes.is_empty() => scan::scan(sizes), (Some("firehose"), &[commits, accounts, ref every @ ..]) if commits >= 4 && accounts >= 1 && every.len() <= 1 => { firehose::firehose( commits, accounts, every.first().copied().unwrap_or(64).max(1), ) } (Some("reads"), &[accounts, records]) if accounts >= 1 => { reads::reads(accounts as usize, records as usize) } (Some("size"), &[accounts, records]) if accounts >= 1 && records >= 1 => { size::size(accounts as usize, records as usize) } (Some("ladder"), &[accounts, records]) if accounts >= 1 && records >= 1 => { ladder::ladder(accounts as usize, records as usize) } (Some("ladder-records"), &[accounts, records]) if accounts >= 1 && records >= 1 => { ladder::records(accounts as usize, records as usize) } // One store read one way, in a process of its own: `reads` starts these. (Some("reads-child"), _) if args.len() == 6 => { let number = |i: usize| args[i].parse().expect("a number"); reads::child( std::path::Path::new(&args[1]), &args[2], &args[3], number(4), number(5), ) } _ => { eprintln!( "store-bench write | spread | unsynced | scan ... | firehose [every] | reads | size | ladder | ladder-records " ); std::process::exit(2); } } }