Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to install and use sysbench

2025-01-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly shows you "how to install and use sysbench", the content is easy to understand, clear, hope to help you solve your doubts, the following let the editor lead you to study and learn "how to install and use sysbench" this article.

Sysbench is an open source, modular, cross-platform multithreaded performance testing tool, which can be used to test the performance of CPU, memory, disk IBO, threads, and databases. Currently supported databases are MySQL, Oracle and PostgreSQL. The following operations will take the support of MySQL databases as an example.

Download sysbench source package and mysql database

\ 1. Currently, the sysbench code is hosted on launchpad. Project address: https://github.com/akopytov/sysbench. Download method:

\ 2. Official download address of MySQL: http://dev.mysql.com/downloads/mysql/, download method:

II. Compilation and installation

\ 1. Mysql database installation:

Mysql database installation can refer to another article of this site: Mysql binary package installation and configuration practice record or directly through the search box on the right side of this site to search Mysql will find a lot of articles about Mysql installation, this article will not explain.

\ 2. Sysbench compilation is very simple. You can refer to the README documentation. The simple steps are as follows:

The above method of tar-zxvf sysbench-0.4.8.tar.gzcd sysbench-0.4.8./configure & & make & & make installstrip / usr/local/bin/sysbench is suitable for installing MySQL in the standard default directory. If MySQL is not installed in the standard directory, you need to specify the path of MySQL yourself. For example, my MySQL likes to be installed under / usr/local/mysql, then compile according to the following method:. / configure-- with-mysql-includes=/usr/local/mysql/include-- with-mysql-libs=/usr/local/mysql/lib & & make & & make install of course, compile with the above parameters, make sure that there is a corresponding so file in your MySQL lib directory, if not, you can download devel or share package to install it. In addition, if you want sysbench to support pgsql/oracle, you need to add parameters-- with-pgsql or-- with-oracle at compile time. These two parameters are turned off by default, and only MySQL is supported by default. III. Preparation before OLTP test

Initialize the test library environment (a total of 10 test tables, each with 100000 records, populated with randomly generated data):

Cd / tmp/sysbench-0.4.12-1.1/sysbenchmysqladmin create sbtest./sysbench-mysql-host=127.0.0.1-mysql-port=3317-mysql-user=tpcc-mysql-password=tpcc\-test=tests/db/oltp.lua-oltp_tables_count=10-oltp-table-size=100000-rand-init=on prepare

The explanation of these parameters:

-- test=tests/db/oltp.lua means calling the tests/db/oltp.lua script to test the oltp schema-- oltp_tables_count=10 indicates that 10 test tables will be generated-- oltp-table-size=100000 indicates that each test table is populated with 100000 data-- rand-init=on indicates that each test table is populated with random data.

If you are on the local machine, you can also use-mysql-socket to specify the socket file to connect. When loading test data, it depends on the amount of data, if the process is relatively long, you need to wait a little patiently.

In the real test scenario, it is recommended to have no less than 10 data tables and no less than 5 million rows of data in a single table. Of course, it depends on the hardware configuration of the server. If you are equipped with a high IOPS device such as SSD or PCIE SSD, it is recommended that you have at least 100 million rows of data in a single table.

4. Conduct OLTP test

Based on the above initialization data parameters, add a few more parameters, and you can begin the test:

. / sysbench-- mysql-host=127.0.0.1-- mysql-port=3306\-- mysql-user=tpcc-- mysql-password=tpcc\-- test=tests/db/oltp.lua-- oltp_tables_count=10\-- oltp-table-size=10000000-- num-threads=8\-- oltp-read-only=off-- report-interval=10\-- rand-type=uniform-- max-time=3600\-- mysql-table-engine=myisam-- max-requests=0\-- percentile=99 run >. / log/sysbench_oltpX_8_20140921.log

The explanation of these parameters:

-- num-threads=8 indicates initiating 8 concurrent connections-- oltp-read-only=off indicates no read-only test, that is, mixed read-write mode testing-- report-interval=10 indicates that a test progress report is output every 10 seconds-- rand-type=uniform indicates that the random type is in fixed mode. Several other optional random modes: uniform (fixed), gaussian (Gaussian), special (specific), pareto (Pareto)-- max-time=120 indicates a maximum execution time of 120 seconds-- max-requests=0 indicates that the total number of requests is 0, because the total execution time has been defined above, so the total number of requests can be set to 0 You can also only set the total number of requests without setting the maximum execution time-percentile=99 means setting the sampling ratio. The default is 95%, that is, 1% of long requests are discarded, and the maximum value is taken in the remaining 99%-mysql-table-engine=myisam indicates that the type of table storage engine tested is myisam.

That is, to simulate the concurrent OLTP test on 10 tables, each table has 10 million rows, and the continuous pressure test time is 1 hour.

In real test scenarios, it is recommended that the continuous stress test time is not less than 30 minutes, otherwise the test data may not be of reference significance.

It should be noted here that there is a mistake in the parameters on the official website, that is,-mysql-table-engine. The official website says-mysql-table-type, which should be caused by not being updated in time.

In addition, the-mysql-table-engine parameter can be specified as the type of table storage engine supported by MySQL, such as innodb.

Fifth, interpretation of test results

The test results are interpreted as follows:

Sysbench 0.5: multi-threaded system evaluation benchmarkRunning the test with following options:Number of threads: 8Report intermediate results every 10 second (s) Random number generator seed is 0 and will be ignoredThreads started!-report test results every 10 seconds Tps, read per second, write per second, response time statistics over 99% [10s] threads: 8, tps: 1111.51, reads/s: 15568.42, writes/s: 4446.13, response time: 9.95ms (99%) [20s] threads: 8, tps: 1121.90, reads/s: 15709.62, writes/s: 4487.80, response time: 9.78ms (99%) [30s] threads: 8, tps: 1120.00, reads/s: 15679.10, writes/s: 4480.20 Response time: 9.84ms (99%) [40s] threads: 8, tps: 1114.20, reads/s: 15599.39, writes/s: 4456.30, response time: 9.90ms (99%) [50s] threads: 8, tps: 1114.00, reads/s: 15593.60, writes/s: 4456.70, response time: 9.84ms (99%) [60s] threads: 8, tps: 1119.30, reads/s: 15671.60, writes/s: 4476.50 Response time: 9.99ms OLTP test statistics: queries performed: read: 938224-- Total number of reads write: 268064-Total number of writes other: 134032-- Total number of other operations (SELECT, INSERT, UPDATE, DELETE) For example, COMMIT, etc.) total: 1340320-total total transactions: 67016 (1116.83 per sec.)-total transactions (transactions per second) deadlocks: 0 (0.00 per sec.)-total deadlocks occurred read/write requests: 1206288 (20103.01 per sec.)-total number of reads and writes (reads and writes per second) other operations: 134032 (2233.67 per sec.)-- Total number of other operations (other operations per second) General statistics:-- some statistics total time: 60.0053s-- Total time-consuming total number of events: 67016-- number of transactions occurred total time taken by event execution: 479.8171s-- all transactions Response time:-- response time statistics min: 4.27ms-- minimum time-consuming avg: 7.16ms-- average time-consuming max: 13.80ms-- longest time-consuming approx. 99 percentile: 9.88ms-over 99% average time consumed Threads fairness: events (avg/stddev): 8377.0000Universe 44.33 execution time (avg/stddev): 59.9771Universe 0.00 is all the content of this article "how to install and use sysbench". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report