Teach the blobstore benchmark to use saved baselines

Summary: We're going to be doing a variety of changes to sqlblob - let's enable working against a known baseline each time, instead of incremental changes.

Reviewed By: ahornby

Differential Revision: D20735796

fbshipit-source-id: 86f15dac1f004b2f3c83ced829a65f3f6e111d6b
This commit is contained in:
Simon Farnsworth 2020-04-01 03:10:26 -07:00 committed by Facebook GitHub Bot
parent aa86f24204
commit cd77fd6c21

View File

@ -22,6 +22,8 @@ mod single_puts;
pub const KB: usize = 1024; pub const KB: usize = 1024;
pub const MB: usize = KB * 1024; pub const MB: usize = KB * 1024;
const ARG_STORAGE_CONFIG_NAME: &'static str = "storage-config-name"; const ARG_STORAGE_CONFIG_NAME: &'static str = "storage-config-name";
const ARG_SAVE_BASELINE: &'static str = "save-baseline";
const ARG_USE_BASELINE: &'static str = "use-baseline";
#[fbinit::main] #[fbinit::main]
fn main(fb: fbinit::FacebookInit) { fn main(fb: fbinit::FacebookInit) {
@ -35,8 +37,36 @@ fn main(fb: fbinit::FacebookInit) {
.takes_value(true) .takes_value(true)
.required(true) .required(true)
.help("the name of the storage config to benchmark"), .help("the name of the storage config to benchmark"),
)
.arg(
Arg::with_name(ARG_SAVE_BASELINE)
.long(ARG_SAVE_BASELINE)
.takes_value(true)
.required(false)
.help("save results as a baseline under given name, for comparison"),
)
.arg(
Arg::with_name(ARG_USE_BASELINE)
.long(ARG_USE_BASELINE)
.takes_value(true)
.required(false)
.conflicts_with(ARG_SAVE_BASELINE)
.help("compare to named baseline instead of last run"),
); );
let matches = app.get_matches(); let matches = app.get_matches();
let mut criterion = Criterion::default()
.measurement_time(Duration::from_secs(60))
.sample_size(10)
.warm_up_time(Duration::from_secs(60));
if let Some(baseline) = matches.value_of(ARG_SAVE_BASELINE) {
criterion = criterion.save_baseline(baseline.to_string());
}
if let Some(baseline) = matches.value_of(ARG_USE_BASELINE) {
criterion = criterion.retain_baseline(baseline.to_string());
}
let logger = args::init_logging(fb, &matches); let logger = args::init_logging(fb, &matches);
args::init_cachelib(fb, &matches, None); args::init_cachelib(fb, &matches, None);
@ -64,11 +94,6 @@ fn main(fb: fbinit::FacebookInit) {
)) ))
.expect("Could not make blobstore"); .expect("Could not make blobstore");
let mut criterion = Criterion::default()
.measurement_time(Duration::from_secs(60))
.sample_size(10)
.warm_up_time(Duration::from_secs(60));
// Tests are run from here // Tests are run from here
single_puts::benchmark(&mut criterion, ctx.clone(), blobstore.clone(), &mut runtime); single_puts::benchmark(&mut criterion, ctx.clone(), blobstore.clone(), &mut runtime);
parallel_puts::benchmark(&mut criterion, ctx.clone(), blobstore.clone(), &mut runtime); parallel_puts::benchmark(&mut criterion, ctx.clone(), blobstore.clone(), &mut runtime);