Mysql:mysqlslap:自带的简单压力测试工具:使用、bug等:续(为了方便阅读)

--number-of-queries参数

首先,该参数限定mysqlslap主线程初始化完成后,所有的、真正的、测试子线程、的累计查询执行次数上限值,是所有测试子线程的累计值

其次,累计次数不能保证是十分精确的,通常指定N,总执行次数就是N,如果没有什么意外抖动的话

然后,特殊的:不指定该参数 or 即该参数的默认值 or 显式设置参数的值为“0”时,它会成为“N=11”,amazing!!! 

最后,当你故意指定参数的值为“<0的负数”时,程序会告诉你,“参数无效,它会自动调整为0”,然后看上面的规则,0成为“N=11”,amazing!!!

[mysql@6CU3515V29 ~]$ mysqlslap -h10.1.101.3 -uroot -proot -e innodb -c1 -a -x2 -y2 --auto-generate-sql-add-autoincrement  --auto-generate-sql-secondary-indexes=0 --auto-generate-sql-write-number=1 --auto-generate-sql-load-type=key  --number-of-queries=1   --only-print |grep -i select|wc -l
mysqlslap: [Warning] Using a password on the command line interface can be insecure.
1
[mysql@6CU3515V29 ~]$ mysqlslap -h10.1.101.3 -uroot -proot -e innodb -c1 -a -x2 -y2 --auto-generate-sql-add-autoincrement  --auto-generate-sql-secondary-indexes=0 --auto-generate-sql-write-number=1 --auto-generate-sql-load-type=key  --number-of-queries=2   --only-print |grep -i select|wc -l
mysqlslap: [Warning] Using a password on the command line interface can be insecure.
2
...
[mysql@6CU3515V29 ~]$ mysqlslap -h10.1.101.3 -uroot -proot -e innodb -c1 -a -x2 -y2 --auto-generate-sql-add-autoincrement  --auto-generate-sql-secondary-indexes=0 --auto-generate-sql-write-number=1 --auto-generate-sql-load-type=key  --number-of-queries=11   --only-print |grep -i select|wc -l
mysqlslap: [Warning] Using a password on the command line interface can be insecure.
11
[mysql@6CU3515V29 ~]$ mysqlslap -h10.1.101.3 -uroot -proot -e innodb -c1 -a -x2 -y2 --auto-generate-sql-add-autoincrement  --auto-generate-sql-secondary-indexes=0 --auto-generate-sql-write-number=1 --auto-generate-sql-load-type=key  --number-of-queries=12   --only-print |grep -i select|wc -l
mysqlslap: [Warning] Using a password on the command line interface can be insecure.
12
[mysql@6CU3515V29 ~]$ mysqlslap -h10.1.101.3 -uroot -proot -e innodb -c1 -a -x2 -y2 --auto-generate-sql-add-autoincrement  --auto-generate-sql-secondary-indexes=0 --auto-generate-sql-write-number=1 --auto-generate-sql-load-type=key  --number-of-queries=0   --only-print |grep -i select|wc -l
mysqlslap: [Warning] Using a password on the command line interface can be insecure.
11
...
[mysql@6CU3515V29 ~]$ mysqlslap -h10.1.101.3 -uroot -proot -e innodb -c1 -a -x2 -y2 --auto-generate-sql-add-autoincrement  --auto-generate-sql-secondary-indexes=0 --auto-generate-sql-write-number=1 --auto-generate-sql-load-type=key  --number-of-queries=-1   --only-print |grep -i select|wc -l
mysqlslap: [Warning] Using a password on the command line interface can be insecure.
mysqlslap: [Warning] option 'number-of-queries': value -1 adjusted to 0.
11
[mysql@6CU3515V29 ~]$ mysqlslap -h10.1.101.3 -uroot -proot -e innodb -c1 -a -x2 -y2 --auto-generate-sql-add-autoincrement  --auto-generate-sql-secondary-indexes=0 --auto-generate-sql-write-number=1 --auto-generate-sql-load-type=key  --number-of-queries=-9   --only-print |grep -i select|wc -l
mysqlslap: [Warning] Using a password on the command line interface can be insecure.
mysqlslap: [Warning] option 'number-of-queries': value -9 adjusted to 0.

-i, --iterations=N参数:测试子线程的重复次数

N默认为1

当N<1时,都会自动调整到默认值1

原文地址:https://www.cnblogs.com/jinzhenshui/p/15480409.html