forked from tadgh/ArgoRevisit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbenchdriver.py
180 lines (166 loc) · 6.27 KB
/
benchdriver.py
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
import os
import logging
import ArgoQueries
import MongoQueries
import PJsonQueries
from bench_utils import TestSuite
from Settings import (
RESULTS_FILENAME,
DATA_SIZE,
NUM_BENCH_ITERATIONS,
)
logging.basicConfig(level=logging.INFO)
log = logging.getLogger(__name__)
###
# Wipe out JSON Documents generated by nobench_data_gen
###
def remove_argo_json_docs():
import Settings
files = [Settings.ARGO_EXTRA_FILENAME, Settings.ARGO_FILENAME]
for filename in files:
if os.path.exists(filename):
os.remove(filename)
def remove_mongo_json_docs():
import Settings
files = [Settings.MONGO_FILENAME, Settings.MONGO_EXTRA_FILENAME]
for filename in files:
if os.path.exists(filename):
os.remove(filename)
if __name__ == "__main__":
q1a = ArgoQueries.Query1Argo()
q2a = ArgoQueries.Query2Argo()
q3a = ArgoQueries.Query3Argo()
q4a = ArgoQueries.Query4Argo()
q5a = ArgoQueries.Query5Argo()
q6a = ArgoQueries.Query6Argo()
q7a = ArgoQueries.Query7Argo()
q8a = ArgoQueries.Query8Argo()
q9a = ArgoQueries.Query9Argo()
q10a = ArgoQueries.Query10Argo()
q11a = ArgoQueries.Query11Argo()
q12a = ArgoQueries.Query12Argo()
q13a = ArgoQueries.Query13Argo()
q14a = ArgoQueries.Query14Argo()
argo_loader = ArgoQueries.InitialLoadArgo()
argo_dropper = ArgoQueries.DropCollectionArgo()
argo_queries = [q1a, q2a, q3a, q4a, q5a, q6a, q7a, q8a, q9a, q10a, q11a, q12a, q13a, q14a]
argo_include_indexes = range(0, 14)
argo_skip_indexes = [10]
argo_test_suite = TestSuite(
tag='Argo',
loader=argo_loader,
cleaner=argo_dropper,
queries_array=argo_queries,
include_indexes=argo_include_indexes,
skip_indexes=argo_skip_indexes,
)
q1m = MongoQueries.Query1Mongo()
q2m = MongoQueries.Query2Mongo()
q3m = MongoQueries.Query3Mongo()
q4m = MongoQueries.Query4Mongo()
q5m = MongoQueries.Query5Mongo()
q6m = MongoQueries.Query6Mongo()
q7m = MongoQueries.Query7Mongo()
q8m = MongoQueries.Query8Mongo()
q9m = MongoQueries.Query9Mongo()
q10m = MongoQueries.Query10Mongo()
q11m = MongoQueries.Query11Mongo()
q12m = MongoQueries.Query12Mongo()
q13m = MongoQueries.Query13Mongo()
q14m = MongoQueries.Query14Mongo()
q15m = MongoQueries.Query15Mongo()
mongo_loader = MongoQueries.InitialLoadMongo()
mongo_dropper = MongoQueries.DropCollectionMongo()
mongo_queries = [q1m, q2m, q3m, q4m, q5m, q6m, q7m, q8m, q9m, q10m, q11m, q12m, q13m, q14m, q15m]
mongo_include_indexes = range(0, 15)
mongo_skip_indexes = []
mongo_test_suite = TestSuite(
tag='Mongo',
loader=mongo_loader,
cleaner=mongo_dropper,
queries_array=mongo_queries,
include_indexes=mongo_include_indexes,
skip_indexes=mongo_skip_indexes,
)
q1p = PJsonQueries.Query1PJson()
q2p = PJsonQueries.Query2PJson()
q3p = PJsonQueries.Query3PJson()
q4p = PJsonQueries.Query4PJson()
q5p = PJsonQueries.Query5PJson()
q6p = PJsonQueries.Query6PJson()
q7p = PJsonQueries.Query7PJson()
q8p = PJsonQueries.Query8PJson()
q9p = PJsonQueries.Query9PJson()
q10p = PJsonQueries.Query10PJson()
q11p = PJsonQueries.Query11PJson()
q12p = PJsonQueries.Query12PJson()
q13p = PJsonQueries.Query13PJson()
q14p = PJsonQueries.Query14PJson()
q15p = PJsonQueries.Query15PJson()
pjson_loader = PJsonQueries.InitialLoadPJson()
pjson_dropper = PJsonQueries.DropCollectionPJson()
pjson_queries = [q1p, q2p, q3p, q4p, q5p, q6p, q7p, q8p, q9p, q10p, q11p, q12p, q13p, q14p, q15p]
pjson_include_indexes = range(0, 15)
pjson_skip_indexes = []
pjson_test_suite = TestSuite(
tag='PJson',
loader=pjson_loader,
cleaner=pjson_dropper,
queries_array=pjson_queries,
include_indexes=pjson_include_indexes,
skip_indexes=pjson_skip_indexes,
)
run_argo_bench = True
run_mongo_bench = True
run_pjson_bench = True
#################################
#Actual testing area begins here.
#################################
if run_argo_bench:
generate_argo_data = True
load_argo_data = True
log.info("Beginning Argo Benchmark.")
if generate_argo_data:
log.info("Argo Generate new Data flag was true. Attempting to remove JSON docs.")
remove_argo_json_docs()
log.info("Generating new data of size: {}.".format(DATA_SIZE))
ArgoQueries.generate_data_argo(DATA_SIZE)
if load_argo_data:
log.info("Cleaning out Argo PostgreSQL.")
argo_test_suite.clean()
log.info("Loading new data into Argo PostgreSQL.")
argo_test_suite.load_data()
log.info("Running Argo Benchmark Queries.")
argo_test_suite.run_bench_queries(NUM_BENCH_ITERATIONS)
log.info("Argo testing suite complete. ")
if run_mongo_bench:
generate_mongo_data = True
load_mongo_data = True
log.info("Beginning Mongo Benchmark.")
if generate_mongo_data:
log.info("Mongo Generate new Data flag was true.")
remove_mongo_json_docs()
log.info("Generating new data of size: {}.".format(DATA_SIZE))
MongoQueries.generate_data_mongo(DATA_SIZE)
if load_mongo_data:
log.info("Cleaning out MongoDB.")
mongo_test_suite.clean()
log.info("Loading new data into MongoDB.")
mongo_test_suite.load_data()
log.info("Running Mongo Benchmark Queries.")
mongo_test_suite.run_bench_queries(NUM_BENCH_ITERATIONS)
log.info("Mongo testing suite complete. ")
if run_pjson_bench:
generate_pjson_data = True
load_pjson_data = True
log.info("Beginning PJson Benchmark.")
if generate_pjson_data:
log.info("PJSON Generate new Data flag was true. Using Mongo's data.")
if load_pjson_data:
log.info("Cleaning out PostgreSQL JSONB.")
pjson_test_suite.clean()
log.info("Loading new data into PostgreSQL JSONB.")
pjson_test_suite.load_data()
log.info("Running PJson Benchmark Queries.")
pjson_test_suite.run_bench_queries(NUM_BENCH_ITERATIONS)
log.info("PJson testing suite complete. ")