From 096d2e3be15361af90257b69dae4b24f751dcab8 Mon Sep 17 00:00:00 2001 From: Douglas Rumbaugh Date: Tue, 14 May 2024 16:18:16 -0400 Subject: Moved thread scalability bench to vldb folder --- benchmarks/insert_query_tput.cpp | 128 --------------------------------------- 1 file changed, 128 deletions(-) delete mode 100644 benchmarks/insert_query_tput.cpp (limited to 'benchmarks/insert_query_tput.cpp') diff --git a/benchmarks/insert_query_tput.cpp b/benchmarks/insert_query_tput.cpp deleted file mode 100644 index 29043af..0000000 --- a/benchmarks/insert_query_tput.cpp +++ /dev/null @@ -1,128 +0,0 @@ -/* - * - */ - -#define ENABLE_TIMER - -#include - -#include "framework/DynamicExtension.h" -#include "shard/ISAMTree.h" -#include "query/irs.h" -#include "framework/interface/Record.h" -#include "include/file_util.h" -#include - -#include - -#include "psu-util/timer.h" - - -typedef de::Record Rec; -typedef de::ISAMTree ISAM; -typedef de::irs::Query Q; -typedef de::DynamicExtension Ext; -typedef de::irs::Parms QP; - -std::atomic inserts_done = false; - -struct timespec delay = {0, 500}; - -void query_thread(Ext *extension, std::vector *queries) { - gsl_rng *rng = gsl_rng_alloc(gsl_rng_mt19937); - size_t total = 0; - - while (!inserts_done.load()) { - auto q_idx = gsl_rng_uniform_int(rng, queries->size()); - - auto q = (*queries)[q_idx]; - q.rng = rng; - q.sample_size = 1000; - - auto res = extension->query(&q); - auto r = res.get(); - total += r.size(); - nanosleep(&delay, nullptr); - } - - fprintf(stderr, "%ld\n", total); - - gsl_rng_free(rng); -} - -void insert_thread(Ext *extension, size_t start, size_t stop, std::vector *records) { - fprintf(stderr, "%ld\t%ld\n", start, stop); - for (size_t i=start; iinsert((*records)[i])) { - nanosleep(&delay, nullptr); - } - } -} - -int main(int argc, char **argv) { - - if (argc < 6) { - fprintf(stderr, "Usage:\n"); - fprintf(stderr, "%s reccnt insert_threads query_threads datafile queryfile\n", argv[0]); - exit(EXIT_FAILURE); - } - - size_t n = atol(argv[1]); - size_t ithread_cnt = atol(argv[2]); - size_t qthread_cnt = atol(argv[3]); - std::string d_fname = std::string(argv[4]); - std::string q_fname = std::string(argv[5]); - - auto extension = new Ext(1000, 12000, 8, 0, 64); - gsl_rng * rng = gsl_rng_alloc(gsl_rng_mt19937); - - auto data = read_sosd_file(d_fname, n); - auto queries = read_range_queries(q_fname, .001); - - /* warmup structure w/ 10% of records */ - size_t warmup = .1 * n; - for (size_t i=0; iinsert(data[i])) { - usleep(1); - } - } - - extension->await_next_epoch(); - - TIMER_INIT(); - - std::vector ithreads(ithread_cnt); - std::vector qthreads(qthread_cnt); - - TIMER_START(); - size_t start = warmup; - size_t per_thread = (n - warmup) / ithread_cnt; - for (size_t i=0; i