I. Introduction of Sysbench
Sysbench is a modular, cross-platform, multi-threaded benchmarking tool designed to evaluate the load of databases under different system parameters. It mainly includes testing in the following ways:
1. CPU Performance
2. Disk IO Performance
3. Scheduling Program Performance
4. Memory allocation and transmission speed
5. POSIX threading Performance
6. Database performance (OLTP benchmark test
Currently, Sysbench mainly supports Mysql,pgsql,oracle database.
The earliest official website http://sysbench.sourceforge.net is no longer available
Project Address: Https://launchpad.net/sysbench can also be used
The latest address Https://github.com/akopytov/sysbench
Second, sysbench installation
Default support MySQL If you need to test oracle/postgresql, you need to add-with-oracle or-with-pgsql parameters when configure.
1, download the source code, and then build their own installation
Installation library Yum install autoconf automake libtool
TAR-XZVF sysbench-0.5.tar.gz
CD Sysbench
chmod +x autogen.sh
./autogen.sh
./configure--with-mysql--with-mysql-includes=/usr/local/mysql/include--with-mysql-libs=/var/lib64/mysql
Make
Make install
Attention:
--with-mysql-includes=/usr/local/mysql/include--with-mysql-libs=/var/lib64/mysql (32-bit system lib64-bit system lib64) These two directories are specified according to the actual system conditions.
2, query Sysbench whether the correct installation sysbench-v
Third, MySQL database test
Sysbench 0.5 replaces previous OLTP with a series of LUA scripts to simulate a more realistic benchmark environment. These test scripts include: Insert.lua, Oltp.lua, Parallel_prepare.lua, Select_random_points.lua
, Update_index.lua, Delete.luaoltp_simple.lua, Select.lua, Select_random_ranges.lua, Update_non_ Index.lua, scripts are used basically like
Sysbench 0.5 uses the Sbtest library by default, but it needs to be created manually, or it can be specified with--MYSQL-DB, and other non-default items specify options:
-mysql-host
-mysql-port
-mysql-socket
-mysql-user
-mysql-password
-mysql-db
-mysql-ssl
Prepare
Parameter interpretation:
–db-driver #服务器类型mysql | Drizzle, default to MySQL
–mysql-table-engine #表存数引擎
–myisam-max-rows #MyISAM表MAX_ROWS选项 (for large tables)
–oltp-table-count=10 #生成表数量 [Sbtest1, Sbtest2 ...]
–oltp-table-size=100000 #生成表的行数
–oltp-secondary #ID列生成二级索引而不是主键
–oltp-auto-inc #设置ID列是否自增on | Off, default is on
–oltp-read-only=on #表示进行只读测试
–rand-init=on #表示每个测试表都是用随机数据来填充的
–report-interval=1 #每1秒打印一次当前的QPS等值
–num-threads=8 #表示发起 8 Concurrent connections
–max-time=120 #表示最大执行时长为 120 seconds
–percentile=99 #表示设定采样比例, the default is 95%, that is, discard 1% of the long request, the remaining 99% to take the maximum value
Initial test, first create table
Sysbench--mysql-host=localhost--mysql-port=3306--mysql-user=root--mysql-password=222222--mysql-db=test-- oltp-tables-count=10--oltp-table-size=600000--num-threads=50--max-requests=100000000--max-time=20-- Report-interval=1--rand-init=on--test=/usr/local/src/sysbench/sysbench/tests/db/oltp.lua Prepare
To start the test:
Sysbench--mysql-host=localhost--mysql-port=3306--mysql-user=root--mysql-password=222222--mysql-db=test-- oltp-tables-count=10--oltp-table-size=600000--num-threads=50--max-requests=100000000--max-time=20-- Report-interval=1--rand-init=on--test=/usr/local/src/sysbench/sysbench/tests/db/oltp.lua Run
650) this.width=650; "title=" sysbench.jpg "alt=" wkiom1ackljxewglaanyk3dltcc013.jpg "src=" http://s1.51cto.com/ Wyfs02/m01/79/d7/wkiom1ackljxewglaanyk3dltcc013.jpg "/>
To clear the test data:
Sysbench--mysql-host=localhost--mysql-port=3306--mysql-user=root--mysql-password=222222--mysql-db=test-- oltp-tables-count=10--oltp-table-size=600000--num-threads=50--max-requests=100000000--max-time=20-- Report-interval=1--rand-init=on--test=/usr/local/src/sysbench/sysbench/tests/db/oltp.lua Cleanup
Reference: Https://www.percona.com/docs/wiki/benchmark:sysbench:olpt.lua
This article is from the "59090939" blog, please be sure to keep this source http://59090939.blog.51cto.com/6338052/1736194
Sysbench0.5 Testing Database Performance