|
|
# sysbench --mysql-host=192.168.10.226 --mysql-port=3306 --mysql-user=root \
/ w1 l- ~. h9 _! `--mysql-password=Changeme_123 --test=/usr/share/sysbench/tests/include/oltp_legacy/oltp.lua --oltp_tables_count=10 \
1 ~ i- `( j/ K6 L$ W+ M. \--oltp-table-size=10000000 --num-threads=8 --oltp-read-only=off --db-driver=mysql \6 l$ D- M: {, D3 a: W
--report-interval=10 --rand-type=uniform --max-time=3600 \. J7 c& u" S2 v6 X1 g }
--max-requests=0 --percentile=99 run >> mysql.log0 c: }% }5 C8 }" X
0 m e! t% y8 ?$ _ R* r! k参数说明
) @6 _0 h: s8 Y. U) a: R* x! R–num-threads=8 表示发起 8个并发连接
+ F- t; {1 G" f+ W1 |4 q
; R M5 i; P& t% O# }* Q–oltp-read-only=off 表示不要进行只读测试,也就是会采用读写混合模式测试9 k9 A6 Y3 ~; F8 C$ H( P' h
+ i' G; A4 R4 F! |4 s5 d–report-interval=10 表示每10秒输出一次测试进度报告. i" r( ?) O* Y" r9 U
' {1 |3 t/ F+ C" ?- J0 X( ?
–rand-type=uniform 表示随机类型为固定模式,其他几个可选随机模式:uniform(固定),gaussian(高斯),special(特定的),pareto(帕累托)8 ~) C9 a9 k" |6 t
7 c) i2 p7 v, N0 p% W–max-time=120 表示最大执行时长为 120秒
" U6 W% W# l, g( F0 V0 ~% ^# }! k' P
–max-requests=0 表示总请求数为 0,因为上面已经定义了总执行时长,所以总请求数可以设定为 0;也可以只设定总请求数,不设定最大执行时长9 H" X: W" g' z$ k8 Z5 F& M3 A
: x6 c. b; D0 R" g7 [+ K–percentile=99 表示设定采样比例,默认是 95%,即丢弃1%的长请求,在剩余的99%里取最大值
C+ J6 G: }9 |+ {% H0 i# l' ~* p" A0 K8 J: b7 e4 {/ Y# `5 Z
即:模拟 对10个表并发OLTP测试,每个表1000万行记录,持续压测时间为 1小时。
& U. h* y" s5 J, |9 ?真实测试场景中,建议持续压测时长不小于30分钟,否则测试数据可能不具参考意义。
% Z) F( S* ~3 ]/ M2 `
0 [) y# m& o7 D. }5 T# x$ l: p( Rsysbench 0.5: multi-threaded system evaluation benchmark
- b: Y0 x; `% Q, X( \$ `6 c1 _( k: e+ _4 n3 j
Running the test with following options:
9 F6 Q. M6 U+ S hNumber of threads: 87 w, }3 k u6 I* K4 h. w
Report intermediate results every 10 second(s)+ `: W6 l* G: ^, e5 Z
Random number generator seed is 0 and will be ignored
2 H ~" b, C6 I# [, J7 X. W u
, s7 @; n) f4 a& i8 @. q2 l% C8 B8 c ^9 y
Threads started!, v1 k, J& I0 d% |% z' I. I
-- 每10秒钟报告一次测试结果,tps、每秒读、每秒写、99%以上的响应时长统计
( T; i h4 a& [$ k- L! [[ 10s] threads: 8, tps: 1111.51, reads/s: 15568.42, writes/s: 4446.13, response time: 9.95ms (99%)+ x1 Z# [3 J$ D. \6 r
[ 20s] threads: 8, tps: 1121.90, reads/s: 15709.62, writes/s: 4487.80, response time: 9.78ms (99%)- @" D& m: t+ n5 a4 I7 m1 t- G$ W+ }
[ 30s] threads: 8, tps: 1120.00, reads/s: 15679.10, writes/s: 4480.20, response time: 9.84ms (99%); Z. H* M7 v% ]* n9 F: o, Y- @' a
[ 40s] threads: 8, tps: 1114.20, reads/s: 15599.39, writes/s: 4456.30, response time: 9.90ms (99%)
! ^! t9 ]3 J, S& }8 h w8 I' W[ 50s] threads: 8, tps: 1114.00, reads/s: 15593.60, writes/s: 4456.70, response time: 9.84ms (99%)4 h4 G( u5 V, O: i
[ 60s] threads: 8, tps: 1119.30, reads/s: 15671.60, writes/s: 4476.50, response time: 9.99ms (99%)
6 U# [ a" x8 R6 @6 C4 F8 H( y% cOLTP test statistics:
; Z5 h7 E0 L# l" W8 y+ ?$ \ queries performed:
; P0 A: ~! K* M$ f read: 938224 -- 读总数" D, Q- Z$ l" r
write: 268064 -- 写总数
4 A& M3 O# V; q+ I7 Z6 A4 X other: 134032 -- 其他操作总数(SELECT、INSERT、UPDATE、DELETE之外的操作,例如COMMIT等)
- ^: Y; W' y1 c total: 1340320 -- 全部总数: Y" y. D4 s+ v4 x: U; ?. J1 D- v
transactions: 67016 (1116.83 per sec.) -- 总事务数(每秒事务数). o) u4 [3 y* c; @5 J
deadlocks: 0 (0.00 per sec.) -- 发生死锁总数
! L' `3 Y2 v5 W read/write requests: 1206288 (20103.01 per sec.) -- 读写总数(每秒读写次数)
6 x0 w7 ~9 s: Q- d6 r; ` other operations: 134032 (2233.67 per sec.) -- 其他操作总数(每秒其他操作次数)* ]* r2 E( ]' Z2 f& T: m. _
* M8 ]' U2 b- uGeneral statistics: -- 一些统计结果
6 R& q/ f$ B( U- Y1 f total time: 60.0053s -- 总耗时3 t/ ?) i6 M( ~& r' X$ R8 j3 N. V
total number of events: 67016 -- 共发生多少事务数
0 _, \8 c. T1 @: o) n+ t# ]+ q4 x total time taken by event execution: 479.8171s -- 所有事务耗时相加(不考虑并行因素). ], W8 |5 U' j% N1 v* B
response time: -- 响应时长统计5 G, E {& b( t: Q$ l
min: 4.27ms -- 最小耗时. m3 |, `1 ?$ r0 D3 y) w
avg: 7.16ms -- 平均耗时; D6 z3 k1 y+ ]5 ~' h4 L
max: 13.80ms -- 最长耗时5 [; a3 d( r" ]) a; l
approx. 99 percentile: 9.88ms -- 超过99%平均耗时
6 A% v4 Z+ |! f( O0 i! ^
6 t; ?5 t6 Z0 a+ H5 rThreads fairness: Z5 F1 T( R7 l8 }7 {. m
events (avg/stddev): 8377.0000/44.33
% j. R1 }0 r' p4 G8 W- g4 o; S execution time (avg/stddev): 59.9771/0.00
6 k, z- P8 t) ^. O( K
& w9 M/ ~$ v: Y6 T: \
8 ]$ _# T2 Q8 z" ?最重要的参数指标:+ {0 S F [0 C
总的事物数,每秒事务数,时间统计信息(最大、最小、平均、95%以上语句响应时间)
+ H& n& R4 J5 T删除数据
/ U6 F+ n( X. G6 E0 n( R) |( i7 n7 Z# L, }7 g" ?$ A
sysbench --mysql-host=192.168.10.226 --mysql-port=3306 --mysql-user=root --mysql-password=Changeme_123 --db-driver=mysql \
@( ^8 {0 `9 m- r+ ~2 h! x+ Y --test=/usr/share/sysbench/tests/include/oltp_legacy/oltp.lua --oltp_tables_count=10 --oltp-table-size=100000 --rand-init=on cleanup
# P5 f: R' ]* p, ^
1 G! l8 E3 i7 m0 p# Z8 \% H% B Q. J |
|