- 积分
- 16840
在线时间 小时
最后登录1970-1-1
|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?开始注册
x
# sysbench --mysql-host=192.168.10.226 --mysql-port=3306 --mysql-user=root \9 Y# d) H) H7 ? k9 X# i
--mysql-password=Changeme_123 --test=/usr/share/sysbench/tests/include/oltp_legacy/oltp.lua --oltp_tables_count=10 \
8 J: i* d& u" P' f- E--oltp-table-size=10000000 --num-threads=8 --oltp-read-only=off --db-driver=mysql \
; l; P5 {* P5 J6 L( D n" X--report-interval=10 --rand-type=uniform --max-time=3600 \
: p* F6 R1 Q, r0 |% ^8 R --max-requests=0 --percentile=99 run >> mysql.log
# T, W+ ^; W/ T6 T/ j) ?/ C6 S, D h e
参数说明 + s0 N7 z; a- d8 v* l+ S% W2 W5 P2 H! ?
–num-threads=8 表示发起 8个并发连接. @' U7 h l0 K/ J9 O! E2 @4 K
" Y% P6 w- _$ M S, O
–oltp-read-only=off 表示不要进行只读测试,也就是会采用读写混合模式测试! t/ n7 t3 x$ z5 R
' f% E0 |1 K+ k1 H, @9 R
–report-interval=10 表示每10秒输出一次测试进度报告) f( P; |9 G8 J7 }
) F0 }5 n5 m% U
–rand-type=uniform 表示随机类型为固定模式,其他几个可选随机模式:uniform(固定),gaussian(高斯),special(特定的),pareto(帕累托)
! K5 z9 |1 r$ E( s; L+ y" d! s5 v3 J/ Z6 P M/ g/ @, r
–max-time=120 表示最大执行时长为 120秒
7 W3 e* P$ j/ ^, ~
9 z& ?+ p* y9 V( c0 ?–max-requests=0 表示总请求数为 0,因为上面已经定义了总执行时长,所以总请求数可以设定为 0;也可以只设定总请求数,不设定最大执行时长
- |) z' t: Y$ I0 O
' k+ j" m1 y5 h6 X7 q–percentile=99 表示设定采样比例,默认是 95%,即丢弃1%的长请求,在剩余的99%里取最大值
9 f# U4 [ k8 j2 `$ B
1 |3 b, ~/ A/ R0 z5 ?0 J/ T- [即:模拟 对10个表并发OLTP测试,每个表1000万行记录,持续压测时间为 1小时。
0 u: U" M+ I/ {+ B! j真实测试场景中,建议持续压测时长不小于30分钟,否则测试数据可能不具参考意义。 |9 ~, [6 A# w- m
8 V7 S, ], U* ~* A3 c9 J: T& osysbench 0.5: multi-threaded system evaluation benchmark
- S' }, \0 ~7 e2 x* b4 v, O0 U2 ]: n* {: s4 ?# _) J7 c. S: e0 r H
Running the test with following options:. m7 Q- g; @2 \
Number of threads: 8
# ]; {' D+ X/ e$ ?. G- I2 }Report intermediate results every 10 second(s)
# W2 X0 f" W8 d+ l! b: {3 rRandom number generator seed is 0 and will be ignored2 D0 F) @3 ~ _) s# \& [
! }3 |6 u; \7 v: b. `' W+ w
1 J6 a0 b- R4 d! @# a* ]
Threads started!& e: K* C1 Z. |& \, S- d4 ~
-- 每10秒钟报告一次测试结果,tps、每秒读、每秒写、99%以上的响应时长统计( o& d3 \, @0 i
[ 10s] threads: 8, tps: 1111.51, reads/s: 15568.42, writes/s: 4446.13, response time: 9.95ms (99%)
; X, @( H* B) Y! h( I; [[ 20s] threads: 8, tps: 1121.90, reads/s: 15709.62, writes/s: 4487.80, response time: 9.78ms (99%)0 v9 s t! D$ O5 K% j' n) o2 `
[ 30s] threads: 8, tps: 1120.00, reads/s: 15679.10, writes/s: 4480.20, response time: 9.84ms (99%)
6 n" u3 J1 D; N( h[ 40s] threads: 8, tps: 1114.20, reads/s: 15599.39, writes/s: 4456.30, response time: 9.90ms (99%)
, q) d1 J/ F* ^/ t' Z[ 50s] threads: 8, tps: 1114.00, reads/s: 15593.60, writes/s: 4456.70, response time: 9.84ms (99%), O% a; m# m0 {
[ 60s] threads: 8, tps: 1119.30, reads/s: 15671.60, writes/s: 4476.50, response time: 9.99ms (99%). C4 u" ?) \( R. B: p2 b
OLTP test statistics:
9 l$ O4 O6 X* X8 D' D queries performed:
) S' M& i* H% x) k1 g0 Y read: 938224 -- 读总数
x7 j9 d' w: l/ X( Z write: 268064 -- 写总数! H- V9 u: O7 e/ o. @) {4 H& H
other: 134032 -- 其他操作总数(SELECT、INSERT、UPDATE、DELETE之外的操作,例如COMMIT等)3 D# ~0 j; v) }1 y) M2 _
total: 1340320 -- 全部总数, l& M8 P2 u3 ], `7 q
transactions: 67016 (1116.83 per sec.) -- 总事务数(每秒事务数). b2 g: A( P& q3 I0 f
deadlocks: 0 (0.00 per sec.) -- 发生死锁总数! T* \" V: | @5 S. a) O
read/write requests: 1206288 (20103.01 per sec.) -- 读写总数(每秒读写次数)% B% V& M# I5 f8 y
other operations: 134032 (2233.67 per sec.) -- 其他操作总数(每秒其他操作次数): R2 y5 w7 v6 U
Z* L6 b" Y4 y S% EGeneral statistics: -- 一些统计结果6 O! ]$ I# f" h" C3 ]: D- k
total time: 60.0053s -- 总耗时/ P+ Q# Y" \ m( i5 }- Y' a; r$ c/ @
total number of events: 67016 -- 共发生多少事务数
( @. G2 q, I D9 n4 K8 n total time taken by event execution: 479.8171s -- 所有事务耗时相加(不考虑并行因素)
2 t# |$ P7 \, g: d/ Q, b8 [3 M& `& H2 E response time: -- 响应时长统计
6 Q/ S1 N L- U U- U min: 4.27ms -- 最小耗时; c9 @, T5 I# `; C
avg: 7.16ms -- 平均耗时" F5 Q) [( _$ v4 Q% _
max: 13.80ms -- 最长耗时1 B$ O8 j$ M1 n- l- c$ L
approx. 99 percentile: 9.88ms -- 超过99%平均耗时
3 s: f8 V' n9 |4 @0 F* y8 _+ T; `4 f
Threads fairness:
) t0 x4 P' Z0 `* U) F events (avg/stddev): 8377.0000/44.33
; S: U- D! ?8 Z' k( P. [, j; V/ H execution time (avg/stddev): 59.9771/0.00+ J, V ~, P" K1 J' q* d3 o
$ [2 b/ N5 M3 [+ U
' z+ d' @. n V3 _最重要的参数指标:& X2 S3 x! _: V- |2 i: e A
总的事物数,每秒事务数,时间统计信息(最大、最小、平均、95%以上语句响应时间)
5 b' L# v3 L+ ^& Y/ U+ S* \8 `删除数据, ~6 t+ G; \7 \1 t2 } S
+ o( T+ U% v: Q2 }& D1 asysbench --mysql-host=192.168.10.226 --mysql-port=3306 --mysql-user=root --mysql-password=Changeme_123 --db-driver=mysql \
0 ~3 v8 x& R1 P. o --test=/usr/share/sysbench/tests/include/oltp_legacy/oltp.lua --oltp_tables_count=10 --oltp-table-size=100000 --rand-init=on cleanup/ S8 C, m( \6 j( E( A
* p" P) e: W$ l) ~* i
|
|