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 use sysbench in MySQL

2025-03-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

MySQL how to use sysbench, many novices are not very clear about this, in order to help you solve this problem, the following editor will explain for you in detail, people with this need can come to learn, I hope you can gain something.

Sysbench

Mysql,postgresql,oracle,cpu, memory, disk, high efficiency, can write lua script according to the characteristics

Pgbench

Postgresql, professional testing pg, simple and efficient

Sysbench installation

Sysbench2.1 supports system version, linux,windows 10 or above. Wsl is required for windows.

Https://github.com/akopytov/sysbench

Git clone https://github.com/akopytov/sysbench.git

. / autogen.sh

# Add-with-pgsql to build with PostgreSQL support

. / configure

Make-j

Make install

Sysbench/ usr/local/share/sysbench/oltp_write_only.lua\

-- mysql-host=skypixel-fish.mysql.database.azure.com\

-- mysql-port=3306\

-- mysql-user=dbmgr@skypixel-fish\

-- mysql-password=DdBZ7pFGnPQANSCh\

-- mysql-db=testdb\

-- db-driver=mysql\

-- tables=15\

-- table-size=5000000\

-- report-interval=3\

-- threads=256\

-- time=300\

Prepare

Run

Prepare/run/cleanup

Https://blog.csdn.net/ashic/article/details/63388358

Https://blog.csdn.net/kai404/article/details/52832848

Https://blog.csdn.net/reblue520/article/details/51050682

Https://www.cnblogs.com/kismetv/archive/2017/09/30/7615738.html

Sysbench

Sysbench/ usr/local/share/sysbench/oltp_write_only.lua\

-- mysql-host=skypixel-fish.mysql.database.azure.com\

-- mysql-port=3306\

-- mysql-user=dbmgr@skypixel-fish\

-- mysql-password=DdBZ7pFGnPQANSCh\

-- mysql-db=testsys\

-- db-driver=mysql\

-- tables=10\

-- table-size=50\

-- report-interval=3\

-- threads=256\

-- time=600\

Prepare

Cleanup

Oltp_read_only.lua:-- there are various Select statements

CREATE TABLE `sbtest1` (

`id`int (11) NOT NULL AUTO_INCREMENT

`k`int (11) NOT NULL DEFAULT'0'

`c` char (120) NOT NULL DEFAULT''

`pad`char (60) NOT NULL DEFAULT''

PRIMARY KEY (`id`)

KEY `k1` (`k`)

) ENGINE=InnoDB AUTO_INCREMENT=51 DEFAULT CHARSET=latin1

Oltp_read_write.lua-- select,update,delete, insert

CREATE TABLE `sbtest1` (

`id`int (11) NOT NULL AUTO_INCREMENT

`k`int (11) NOT NULL DEFAULT'0'

`c` char (120) NOT NULL DEFAULT''

`pad`char (60) NOT NULL DEFAULT''

PRIMARY KEY (`id`)

KEY `k1` (`k`)

) ENGINE=InnoDB AUTO_INCREMENT=51 DEFAULT CHARSET=latin1

Oltp_write_only.lua-- > update and insert statements

CREATE TABLE `sbtest1` (

`id`int (11) NOT NULL AUTO_INCREMENT

`k`int (11) NOT NULL DEFAULT'0'

`c` char (120) NOT NULL DEFAULT''

`pad`char (60) NOT NULL DEFAULT''

PRIMARY KEY (`id`)

KEY `k1` (`k`)

) ENGINE=InnoDB AUTO_INCREMENT=51 DEFAULT CHARSET=latin1

Set global general_log=ON

Tailf / var/lib/mysql/mysql01.log

Oltp_read_only oltp_read_write

Sysbench/ usr/local/share/sysbench/oltp_read_only.lua\

-- mysql-host=127.0.0.1\

-- mysql-port=3306\

-- mysql-user=root\

-- mysql-password=Ysysljj443322!

-- mysql-db=sysbench\

-- db-driver=mysql\

-- tables=10\

-- table-size=5000\

-- report-interval=3\

-- threads=2\

-- time=60\

Run

The bigger the threads, the bigger the tps,qps.

Prepare

Cleanup

Http://echarts.baidu.com/echarts2/doc/example/line1.html#macarons

TPS:

Grep "^\ [" 1.log | awk-F' ('{print $1}'| sed-e "s /\ [\ /\ {'time':'/g"-e "s /\\] / g"-e "2.log:\ /':'/ g"-e "s /\ /','/ g"-e "s /\} / g" > 2.log

Awk-F:'{print $4} '2.log | awk-F,' {print $1 ","}'| awk'{for

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

Database

Wechat

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

12
Report