-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsysbench_call_api2.py
More file actions
83 lines (74 loc) · 3.56 KB
/
sysbench_call_api2.py
File metadata and controls
83 lines (74 loc) · 3.56 KB
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
"""
/*
* Software Name : Microtune
* SPDX-FileCopyrightText: Copyright (c) Orange SA
* SPDX-License-Identifier: MIT
*
* This software is distributed under the MIT license,
* see the "LICENSE" file for more details
*
* Authors: see CONTRIBUTORS.md
* Software description: MicroTune is a RL-based DBMS Buffer Pool Auto-Tuning for Optimal and Economical Memory Utilization. Consumed RAM is continously and optimally adjusted in conformance of a SLA constraint (maximum mean latency).
*/
"""
import time
from pkg.tools.sysbench.sbrequest import SysbenchRequest
# Admin request
#wl = SysbenchRequest(dbhost="192.168.0.206", id="oltp_read_write", tables=3, tablesize=50000) #TUN03
#wl = SysbenchRequest(dbhost="db.local", id="oltp_read_write", tables=2, tablesize=500)
#wl = SysbenchRequest(dbhost="192.168.0.212", id="oltp_read_write", tables=15, tablesize=50000) #TUN02
#wl = SysbenchRequest(httphost="workload_sb.local", dbhost="db.local", id="oltp_read_write", tables=35, tablesize=500000) #TUN06
w0 = SysbenchRequest(httphost="192.168.0.136", dbhost="192.168.0.143", id="oltp_read_write", tables=10, tablesize=1000) #TUN06
wl0 = SysbenchRequest(httphost="192.168.0.136", dbhost="192.168.0.143", id="oltp_read_write", tables=50, tablesize=1000000) #TUN06
wl1 = SysbenchRequest(httphost="192.168.0.136", dbhost="192.168.0.143", id="oltp_read_write", tables=10, tablesize=100000) #TUN06
wl2 = SysbenchRequest(httphost="192.168.0.136", dbhost="192.168.0.143", id="oltp_read_write", tables=15, tablesize=150000) #TUN06
wl3 = SysbenchRequest(httphost="192.168.0.136", dbhost="192.168.0.143", id="oltp_read_write", tables=20, tablesize=200000) #TUN06
# Load: Duration, VUS, Randtype
loads = [
# { "w": wl1, "d": 120, "v": 3, "r": "uniform"},
# { "w": wl1, "d": 240, "v": 7, "r": "special"},
# { "w": wl2, "d": 120, "v": 7, "r": "uniform"},
# { "w": wl1, "d": 60, "v": 2, "r": "special"},
# { "w": wl3, "d": 120, "v": 5, "r": "uniform"},
# { "w": wl1, "d": 240, "v": 5, "r": "special"},
# { "w": wl1, "d": 480, "v": 1, "r": "gaussian"},
# { "w": wl3, "d": 120, "v": 5, "r": "uniform"},
{ "w": wl3, "d": 600, "v": 8, "r": "uniform"},
{ "w": wl1, "d": 600, "v": 10, "r": "uniform"},
{ "w": wl1, "d": 600, "v": 12, "r": "uniform"},
{ "w": wl2, "d": 600, "v": 6, "r": "uniform"},
{ "w": wl2, "d": 600, "v": 10, "r": "uniform"},
{ "w": wl2, "d": 600, "v": 12, "r": "uniform"},
]
# For test
loads = [ { "w": w0, "d": 600, "v": 3, "r": "uniform"} ]
# A representative load test
wYif = SysbenchRequest(httphost="192.168.0.136", dbhost="192.168.0.143", id="oltp_read_write", tables=50, tablesize=1000000) #TUN06
loads = [
{ "w": wYif, "d": 2500, "v": 2, "r": "gaussian"},
{ "w": wYif, "d": 2500, "v": 8, "r": "gaussian"},
{ "w": wYif, "d": 2500, "v": 4, "r": "gaussian"},
{ "w": wYif, "d": 2500, "v": 3, "r": "uniform"},
{ "w": wYif, "d": 2500, "v": 2, "r": "special"},
{ "w": wYif, "d": 2500, "v": 2, "r": "special"},
{ "w": wYif, "d": 2500, "v": 1, "r": "special"},
{ "w": wYif, "d": 2500, "v": 1, "r": "special"},
]
prev_wl = None
wYif.cancel()
time.sleep(10)
for cl in loads:
wl = cl["w"]
if wl != prev_wl:
prev_wl = wl
print("Admin...")
#wl.admin(cmd="cleanup", sleep_after=0)
#wl.admin(cmd="prepare", sleep_after=1)
print("Admin OK")
print(f'ASync Load vus={cl["v"]} during {cl["d"]}s')
# wl.load(vus=cl["v"], duration=cl["d"], randtype=cl["r"])
wl.load(vus=cl["v"], duration=0, randtype=cl["r"])
print(f'Wait {cl["d"]+3}s')
time.sleep(cl["d"]+3)
wl.cancel() # Just in case...
exit(0)