From d096c56f7756c862a42ccf048e1120afc3ffb5c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20Ko=C5=82aczkowski?= Date: Tue, 7 Dec 2021 14:03:03 +0100 Subject: [PATCH] More sai workload files --- workloads/sai/read-equals-hc.rn | 33 ++++++++++++++++++++++++++ workloads/sai/read-equals-lc.rn | 33 ++++++++++++++++++++++++++ workloads/sai/read-intersect-lc-hc.rn | 34 +++++++++++++++++++++++++++ workloads/sai/read-intersect-lc-mc.rn | 34 +++++++++++++++++++++++++++ workloads/sai/read-union-hc-hc.rn | 34 +++++++++++++++++++++++++++ workloads/sai/read-union-lc-lc.rn | 34 +++++++++++++++++++++++++++ 6 files changed, 202 insertions(+) create mode 100644 workloads/sai/read-equals-hc.rn create mode 100644 workloads/sai/read-equals-lc.rn create mode 100644 workloads/sai/read-intersect-lc-hc.rn create mode 100644 workloads/sai/read-intersect-lc-mc.rn create mode 100644 workloads/sai/read-union-hc-hc.rn create mode 100644 workloads/sai/read-union-lc-lc.rn diff --git a/workloads/sai/read-equals-hc.rn b/workloads/sai/read-equals-hc.rn new file mode 100644 index 0000000..2d4c976 --- /dev/null +++ b/workloads/sai/read-equals-hc.rn @@ -0,0 +1,33 @@ +mod common; + +use common::{KEYSPACE, TABLE, LC, HC}; +use latte::*; + +pub const LOAD_COUNT = latte::param!("rows", 100000); + +const READ_SIZE = latte::param!("read_size", 10); + +const READ = "read"; + +pub async fn schema(db) { + common::init_schema(db).await?; +} + +pub async fn erase(db) { + common::erase(db).await?; +} + +pub async fn prepare(db) { + common::prepare(db).await?; + db.prepare(READ, `SELECT * FROM ${KEYSPACE}.${TABLE} + WHERE hc = ? LIMIT ${READ_SIZE}`).await?; +} + +pub async fn load(db, i) { + common::insert_row(db, i).await?; +} + +pub async fn run(db, i) { + let hc = hash2(i, 26709) % HC; + db.execute_prepared(READ, [hc]).await?; +} diff --git a/workloads/sai/read-equals-lc.rn b/workloads/sai/read-equals-lc.rn new file mode 100644 index 0000000..c4abb26 --- /dev/null +++ b/workloads/sai/read-equals-lc.rn @@ -0,0 +1,33 @@ +mod common; + +use common::{KEYSPACE, TABLE, LC, HC}; +use latte::*; + +pub const LOAD_COUNT = latte::param!("rows", 100000); + +const READ_SIZE = latte::param!("read_size", 10); + +const READ = "read"; + +pub async fn schema(db) { + common::init_schema(db).await?; +} + +pub async fn erase(db) { + common::erase(db).await?; +} + +pub async fn prepare(db) { + common::prepare(db).await?; + db.prepare(READ, `SELECT * FROM ${KEYSPACE}.${TABLE} + WHERE lc = ? LIMIT ${READ_SIZE}`).await?; +} + +pub async fn load(db, i) { + common::insert_row(db, i).await?; +} + +pub async fn run(db, i) { + let lc = hash2(i, 26709) % LC; + db.execute_prepared(READ, [lc]).await?; +} diff --git a/workloads/sai/read-intersect-lc-hc.rn b/workloads/sai/read-intersect-lc-hc.rn new file mode 100644 index 0000000..8e502dc --- /dev/null +++ b/workloads/sai/read-intersect-lc-hc.rn @@ -0,0 +1,34 @@ +mod common; + +use common::{KEYSPACE, TABLE, LC, HC}; +use latte::*; + +pub const LOAD_COUNT = latte::param!("rows", 100000); + +const READ_SIZE = latte::param!("read_size", 10); + +const READ = "read"; + +pub async fn schema(db) { + common::init_schema(db).await?; +} + +pub async fn erase(db) { + common::erase(db).await?; +} + +pub async fn prepare(db) { + common::prepare(db).await?; + db.prepare(READ, `SELECT * FROM ${KEYSPACE}.${TABLE} + WHERE lc = ? AND hc = ? LIMIT ${READ_SIZE}`).await?; +} + +pub async fn load(db, i) { + common::insert_row(db, i).await?; +} + +pub async fn run(db, i) { + let lc = hash2(i, 26709) % LC; + let hc = hash2(i, 67633) % HC; + db.execute_prepared(READ, [lc, hc]).await?; +} diff --git a/workloads/sai/read-intersect-lc-mc.rn b/workloads/sai/read-intersect-lc-mc.rn new file mode 100644 index 0000000..23b7b80 --- /dev/null +++ b/workloads/sai/read-intersect-lc-mc.rn @@ -0,0 +1,34 @@ +mod common; + +use common::{KEYSPACE, TABLE, LC, MC}; +use latte::*; + +pub const LOAD_COUNT = latte::param!("rows", 100000); + +const READ_SIZE = latte::param!("read_size", 10); + +const READ = "read"; + +pub async fn schema(db) { + common::init_schema(db).await?; +} + +pub async fn erase(db) { + common::erase(db).await?; +} + +pub async fn prepare(db) { + common::prepare(db).await?; + db.prepare(READ, `SELECT * FROM ${KEYSPACE}.${TABLE} + WHERE lc = ? AND mc = ? LIMIT ${READ_SIZE}`).await?; +} + +pub async fn load(db, i) { + common::insert_row(db, i).await?; +} + +pub async fn run(db, i) { + let lc = hash2(i, 26709) % LC; + let mc = hash2(i, 6773) % MC; + db.execute_prepared(READ, [lc, mc]).await?; +} diff --git a/workloads/sai/read-union-hc-hc.rn b/workloads/sai/read-union-hc-hc.rn new file mode 100644 index 0000000..bf3e832 --- /dev/null +++ b/workloads/sai/read-union-hc-hc.rn @@ -0,0 +1,34 @@ +mod common; + +use common::{KEYSPACE, TABLE, HC}; +use latte::*; + +pub const LOAD_COUNT = latte::param!("rows", 100000); + +const READ_SIZE = latte::param!("read_size", 10); + +const READ = "read"; + +pub async fn schema(db) { + common::init_schema(db).await?; +} + +pub async fn erase(db) { + common::erase(db).await?; +} + +pub async fn prepare(db) { + common::prepare(db).await?; + db.prepare(READ, `SELECT * FROM ${KEYSPACE}.${TABLE} + WHERE hc = ? OR hc = ? LIMIT ${READ_SIZE}`).await?; +} + +pub async fn load(db, i) { + common::insert_row(db, i).await?; +} + +pub async fn run(db, i) { + let hc1 = hash2(i, 85790) % HC; + let hc2 = hash2(i, 24303) % HC; + db.execute_prepared(READ, [hc1, hc2]).await?; +} diff --git a/workloads/sai/read-union-lc-lc.rn b/workloads/sai/read-union-lc-lc.rn new file mode 100644 index 0000000..5a9bf75 --- /dev/null +++ b/workloads/sai/read-union-lc-lc.rn @@ -0,0 +1,34 @@ +mod common; + +use common::{KEYSPACE, TABLE, LC}; +use latte::*; + +pub const LOAD_COUNT = latte::param!("rows", 100000); + +const READ_SIZE = latte::param!("read_size", 10); + +const READ = "read"; + +pub async fn schema(db) { + common::init_schema(db).await?; +} + +pub async fn erase(db) { + common::erase(db).await?; +} + +pub async fn prepare(db) { + common::prepare(db).await?; + db.prepare(READ, `SELECT * FROM ${KEYSPACE}.${TABLE} + WHERE lc = ? OR lc = ? LIMIT ${READ_SIZE}`).await?; +} + +pub async fn load(db, i) { + common::insert_row(db, i).await?; +} + +pub async fn run(db, i) { + let lc1 = hash2(i, 85790) % LC; + let lc2 = hash2(i, 24303) % LC; + db.execute_prepared(READ, [lc1, lc2]).await?; +}