forked from BLepers/KVell
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.c
74 lines (66 loc) · 2.71 KB
/
main.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#include "headers.h"
#include "workload-common.h"
int main(int argc, char **argv) {
int nb_disks, nb_workers_per_disk;
declare_timer;
/* Definition of the workload, if changed you need to erase the DB before
* relaunching */
struct workload w = {
.api = &YCSB, .nb_items_in_db = 100000000LU, .nb_load_injectors = 8,
//.nb_load_injectors = 12, // For scans (see scripts/run-aws.sh and
//OVERVIEW.md)
};
/* Parsing of the options */
if (argc < 3)
die("Usage: ./main <nb disks> <nb workers per disk>\n\tData is stored in "
"%s\n",
PATH);
nb_disks = atoi(argv[1]);
nb_workers_per_disk = atoi(argv[2]);
/* Pretty printing useful info */
printf("# Configuration:\n");
printf("# \tPage cache size: %lu GB\n", PAGE_CACHE_SIZE / 1024 / 1024 / 1024);
printf("# \tWorkers: %d working on %d disks\n",
nb_disks * nb_workers_per_disk, nb_disks);
printf(
"# \tIO configuration: %d queue depth (capped: %s, extra waiting: %s)\n",
QUEUE_DEPTH, NEVER_EXCEED_QUEUE_DEPTH ? "yes" : "no",
WAIT_A_BIT_FOR_MORE_IOS ? "yes" : "no");
printf("# \tQueue configuration: %d maximum pending callbaks per worker\n",
MAX_NB_PENDING_CALLBACKS_PER_WORKER);
printf("# \tDatastructures: %d (memory index) %d (pagecache)\n", MEMORY_INDEX,
PAGECACHE_INDEX);
printf("# \tThread pinning: %s\n", PINNING ? "yes" : "no");
printf("# \tBench: %s (%lu elements)\n", w.api->api_name(), w.nb_items_in_db);
/* Initialization of random library */
start_timer {
printf("Initializing random number generator (Zipf) -- this might take a "
"while for large databases...\n");
init_zipf_generator(0, w.nb_items_in_db -
1); /* This takes about 3s... not sure why, but
this is legacy code :/ */
}
stop_timer("Initializing random number generator (Zipf)");
/* Recover database */
start_timer { slab_workers_init(nb_disks, nb_workers_per_disk); }
stop_timer("Init found %lu elements", get_database_size());
/* Add missing items if any */
repopulate_db(&w);
/* Launch benchs */
bench_t workload, workloads[] = {
ycsb_a_uniform,
// ycsb_a_uniform, ycsb_b_uniform, ycsb_c_uniform,
// ycsb_a_zipfian, ycsb_b_zipfian, ycsb_c_zipfian,
// //ycsb_e_uniform, ycsb_e_zipfian, // Scans
};
foreach (workload, workloads) {
if (workload == ycsb_e_uniform || workload == ycsb_e_zipfian) {
w.nb_requests =
2000000LU; // requests for YCSB E are longer (scans) so we do less
} else {
w.nb_requests = 100000000LU;
}
run_workload(&w, workload);
}
return 0;
}