Skip to content

Commit 6316671

Browse files
committed
tools/crimson/crimson_stress_tool: add sequential read and write
Signed-off-by: Xinyu Huang <xinyu.huang@intel.com>
1 parent db4c804 commit 6316671

File tree

2 files changed

+97
-28
lines changed

2 files changed

+97
-28
lines changed

tools/crimson/README.rst

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ Example:
103103
104104
sudo ./crimson_stress_tool.py \
105105
--client-list 4 8 --thread-list 2 4 6 --taskset 16-31 --time 300 \
106-
--write 0.75 \
106+
--rand-write 0.75 \
107107
--rand-read 0.25 \
108108
--reactor-utilization True \
109109
--perf True \
@@ -122,12 +122,12 @@ Example of result:
122122

123123
.. code-block:: console
124124
125-
write_bandwidth 3.10453 3.541689 3.5182199999999995 2.51662
126-
write_iops 793.0 903.0 900.0 642.0
127-
write_latency 0.0037714466666666662 0.006630723333333334 0.006629473333333333 0.0186881
128-
read_bandwidth 2.84725 2.68286 3.05852 1.471667
129-
read_iops 728.0 686.0 782.0 376.0
130-
read_latency 0.00136141 0.002904295000000000 0.00254781 0.01060875
125+
rw_bandwidth 3.10453 3.541689 3.5182199999999995 2.51662
126+
rw_iops 793.0 903.0 900.0 642.0
127+
rw_latency 0.0037714466666666662 0.006630723333333334 0.006629473333333333 0.0186881
128+
rr_bandwidth 2.84725 2.68286 3.05852 1.471667
129+
rr_iops 728.0 686.0 782.0 376.0
130+
rr_latency 0.00136141 0.002904295000000000 0.00254781 0.01060875
131131
reactor_utilization 51.76855957999997 63.44185818000002 62.81135658000002 57.04136848000001
132132
context-switches 21343 20060 20770 18164
133133
cpu_cycle 4617829192 4504157482 4539431704 4732829464

tools/crimson/crimson_stress_tool.py

Lines changed: 90 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -53,16 +53,16 @@ def post_process(env, test_case_result):
5353
pass
5454

5555

56-
class RadosWriteThread(Task):
56+
class RadosRandWriteThread(Task):
5757
def __init__(self, env):
5858
super().__init__(env)
5959
self.task_set = env.args.taskset
6060
self.block_size = env.args.block_size
6161
self.time = env.args.time
6262
self.pool = env.pool
63-
self.iops_key = "write_iops"
64-
self.latency_key = "write_latency"
65-
self.bandwidth_key = "write_bandwidth"
63+
self.iops_key = "rw_iops"
64+
self.latency_key = "rw_latency"
65+
self.bandwidth_key = "rw_bandwidth"
6666

6767
def create_command(self):
6868
rados_bench_write = "sudo taskset -c " + self.task_set \
@@ -91,19 +91,41 @@ def analyse(self):
9191

9292
@staticmethod
9393
def post_process(env, test_case_result):
94-
ratio = env.testclient_threadclass_ratio_map[RadosWriteThread]
95-
test_case_result["write_iops"] *= \
94+
ratio = env.testclient_threadclass_ratio_map[RadosRandWriteThread]
95+
test_case_result["rw_iops"] *= \
9696
int(test_case_result['client_num'] * ratio)
97-
test_case_result["write_bandwidth"] *= \
97+
test_case_result["rw_bandwidth"] *= \
9898
int(test_case_result['client_num'] * ratio)
9999

100100

101-
class RadosRandReadThread(RadosWriteThread):
101+
class RadosSeqWriteThread(RadosRandWriteThread):
102102
def __init__(self, env):
103103
super().__init__(env)
104-
self.iops_key = "read_iops"
105-
self.latency_key = "read_latency"
106-
self.bandwidth_key = "read_bandwidth"
104+
self.iops_key = "sw_iops"
105+
self.latency_key = "sw_latency"
106+
self.bandwidth_key = "sw_bandwidth"
107+
def create_command(self):
108+
rados_bench_write = "sudo taskset -c " + self.task_set \
109+
+ " bin/rados bench -p " + self.pool + " " \
110+
+ self.time + " write -t " \
111+
+ str(self.thread_num) + " " \
112+
+ "--no-cleanup"
113+
return rados_bench_write
114+
@staticmethod
115+
def post_process(env, test_case_result):
116+
ratio = env.testclient_threadclass_ratio_map[RadosSeqWriteThread]
117+
test_case_result["sw_iops"] *= \
118+
int(test_case_result['client_num'] * ratio)
119+
test_case_result["sw_bandwidth"] *= \
120+
int(test_case_result['client_num'] * ratio)
121+
122+
123+
class RadosRandReadThread(RadosRandWriteThread):
124+
def __init__(self, env):
125+
super().__init__(env)
126+
self.iops_key = "rr_iops"
127+
self.latency_key = "rr_latency"
128+
self.bandwidth_key = "rr_bandwidth"
107129

108130
def create_command(self):
109131
rados_bench_rand_read = "sudo taskset -c " + self.task_set \
@@ -125,12 +147,44 @@ def pre_process(env):
125147
@staticmethod
126148
def post_process(env, test_case_result):
127149
ratio = env.testclient_threadclass_ratio_map[RadosRandReadThread]
128-
test_case_result["read_iops"] *= \
150+
test_case_result["rr_iops"] *= \
129151
int(test_case_result['client_num'] * ratio)
130-
test_case_result["read_bandwidth"] *= \
152+
test_case_result["rr_bandwidth"] *= \
131153
int(test_case_result['client_num'] * ratio)
132154

133155

156+
class RadosSeqReadThread(RadosRandWriteThread):
157+
def __init__(self, env):
158+
super().__init__(env)
159+
self.iops_key = "sr_iops"
160+
self.latency_key = "sr_latency"
161+
self.bandwidth_key = "sr_bandwidth"
162+
163+
def create_command(self):
164+
rados_bench_seq_read = "sudo taskset -c " + self.task_set \
165+
+ " bin/rados bench -p " + self.pool + " " \
166+
+ self.time + " seq -t " \
167+
+ str(self.thread_num) \
168+
+ " --no-cleanup"
169+
return rados_bench_seq_read
170+
171+
@staticmethod
172+
def pre_process(env):
173+
env_write_command = "sudo bin/rados bench -p " + env.pool + " " \
174+
+ " 60 write -t " \
175+
+ str(300) + " " \
176+
+ "--no-cleanup"
177+
os.system(env_write_command + " >/dev/null")
178+
print('rados seq read test environment OK')
179+
180+
@staticmethod
181+
def post_process(env, test_case_result):
182+
ratio = env.testclient_threadclass_ratio_map[RadosSeqReadThread]
183+
test_case_result["sr_iops"] *= \
184+
int(test_case_result['client_num'] * ratio)
185+
test_case_result["sr_bandwidth"] *= \
186+
int(test_case_result['client_num'] * ratio)
187+
134188
class FioRBDRandWriteThread(Task):
135189
def __init__(self, env):
136190
super().__init__(env)
@@ -219,7 +273,7 @@ def __init__(self, env):
219273
self.lat = 'fio_rr_lat'
220274
self.bw = 'fio_rr_bw'
221275
self.iops = 'fio_rr_iops'
222-
276+
223277
@staticmethod
224278
def post_process(env, test_case_result):
225279
env.images = []
@@ -236,6 +290,7 @@ def __init__(self, env):
236290
super().__init__(env)
237291
self.start_time = int(env.args.time)/2
238292
self.osd = "osd.0"
293+
self.task_set = env.args.taskset
239294

240295
def create_command(self):
241296
command = "sudo bin/ceph tell " \
@@ -469,19 +524,25 @@ def __init__(self, args):
469524

470525
def init_thread_list(self):
471526
# 1. add the test case based thread classes and the ratio to the dict.
472-
if self.args.write:
473-
self.testclient_threadclass_ratio_map[RadosWriteThread] = \
474-
self.args.write
527+
if self.args.rand_write:
528+
self.testclient_threadclass_ratio_map[RadosRandWriteThread] = \
529+
self.args.rand_write
475530
if self.args.rand_read:
476531
self.testclient_threadclass_ratio_map[RadosRandReadThread] = \
477532
self.args.rand_read
533+
if self.args.seq_write:
534+
self.testclient_threadclass_ratio_map[RadosSeqWriteThread] = \
535+
self.args.seq_write
536+
if self.args.seq_read:
537+
self.testclient_threadclass_ratio_map[RadosSeqReadThread] = \
538+
self.args.seq_read
478539
if self.args.fio_rbd_rand_write:
479540
self.testclient_threadclass_ratio_map[FioRBDRandWriteThread] = \
480541
self.args.fio_rbd_rand_write
481542
if self.args.fio_rbd_rand_read:
482543
self.testclient_threadclass_ratio_map[FioRBDRandReadThread] = \
483544
self.args.fio_rbd_rand_read
484-
545+
485546
if not self.testclient_threadclass_ratio_map:
486547
raise Exception("Please set at least one base test.")
487548

@@ -644,16 +705,24 @@ def get_disk_name(self):
644705
type = bool,
645706
default = True,
646707
help = 'run osds in single core')
647-
708+
648709
# test case based thread param
649-
parser.add_argument('--write',
710+
parser.add_argument('--rand-write',
650711
type = float,
651712
default = 0,
652-
help = 'ratio of rados bench write clients')
713+
help = 'ratio of rados bench rand write clients')
653714
parser.add_argument('--rand-read',
654715
type = float,
655716
default = 0,
656717
help = 'ratio of rados bench rand read clients')
718+
parser.add_argument('--seq-write',
719+
type = float,
720+
default = 0,
721+
help = 'ratio of rados bench seq write clients')
722+
parser.add_argument('--seq-read',
723+
type = float,
724+
default = 0,
725+
help = 'ratio of rados bench seq read clients')
657726
parser.add_argument('--fio-rbd-rand-write',
658727
type = float,
659728
default = 0,

0 commit comments

Comments
 (0)