l-host=10.11.0.160 --mysql-port=3302--oltp-tables-count=100 --num-threads=32 --max-requests=200000--report-interval=2 run
./sysbench --test=./tests/db/oltp.lua--mysql-table-engine=innodb --oltp-table-size=200000 --mysql-user=thunder--mysql-password=thunder --mysql-host=10.11.0.160 --mysql-port=3303--oltp-tables-count=100 --num-threads=32 --max-requests=200000--report-interval=2 run
./sysbench --test=./tests/db/oltp.lua--mysql-table-engine=innodb --oltp-table-size=200000 --mysql-user=thunder--mysql-password=thunder --mysql-host=10.11.0.160 --mysql-port=3304--oltp-tables-count=100 --num-threads=32 --max-requests=200000--report-interval=2 run
./sysbench --test=./tests/db/oltp.lua--mysql-table-engine=innodb --oltp-table-size=200000 --mysql-user=thunder--mysql-password=thunder --mysql-host=10.11.0.160 --mysql-port=3305--oltp-tables-count=100 --num-threads=32 --max-requests=200000--report-interval=2 run
./sysbench --test=./tests/db/oltp.lua--mysql-table-engine=innodb --oltp-table-size=200000 --mysql-user=thunder--mysql-password=thunder --mysql-host=10.11.0.160 --mysql-port=3306--oltp-tables-count=100 --num-threads=32 --max-requests=200000 --report-interval=2run
./sysbench --test=./tests/db/oltp.lua--mysql-table-engine=innodb --oltp-table-size=200000 --mysql-user=thunder--mysql-password=thunder --mysql-host=10.11.0.160 --mysql-port=3307--oltp-tables-count=100 --num-threads=32 --max-requests=200000--report-interval=2 run
./sysbench --test=./tests/db/oltp.lua--mysql-table-engine=innodb --oltp-table-size=200000 --mysql-user=thunder--mysql-password=thunder --mysql-host=10.11.0.160 --mysql-port=3308--oltp-tables-count=100 --num-threads=32 --max-requests=200000--report-interval=2 run
测试数据:
总结:
当压力源为内网其它机器时,可以看出2台机器TPS/QPS相差不大,其原因为MySQL服务器的物理机网卡已经跑满,此时的瓶颈为网卡。
当压力源为MySQL服务器本机时,可以看出多实例单库的性能要比单实例多库的性能高出20%左右,但是其本机负载也很高,最高达到了225,CPU idle值为0,机器资源已经用光,而单实例多库机器的负载最高为65,机器还有剩余资源,CPUidle值为6左右,此时的瓶颈为CPU。
以上测试没有针对数据库进行较精细的测试,只是通过sqlbench测试相同配置机器多实例单库与单实例多库性能的对比,已经有相关进行参考。
通过上面的数据,肯定很多人会选择多实例单库,而我却没有采用多实例的方式,原因如下:
对于业务来说,一般情况下是服务与数据库不在同一台机器,通过测试可以看出,在网络为瓶颈的情况下,两种方式的TPS/QPS是相差不多的,单实例多库这种方式维护起来又很方便。