前言
⛳️ 1. HammerDB简介
⛳️ 2. 容器部署
✨ 2.1 镜像下载
✨ 2.2 创建容器
✨ 2.3 Linux 下安装
✨ 2.4 相关校验
⛳️3 . HammerDB压测MySQL
前言HammerDB 是一个开源的数据库负载测试和基准测试工具,同时支持 Windows 和 Linux 平台。
⛳️ 1. HammerDB简介⛳️ 2. 容器部署 ✨ 2.1 镜像下载HammerDB 是一个开源的数据库负载测试和基准测试工具,同时支持 Windows 和 Linux 平台,可以针对 Oracle 、SQL Server、DB2、TimesTen、 MySQL、MariaDB、
PostgreSQL、Postgres Plus Advanced Server、Greenplum、Redis、Amazon Aurora、Redshift 等进行压力测试。
它主要模拟两种不同的测试模型:TPC-C 测试模型和 TPC-H 测试模型。相比于标准的 TPC-C 和 TPC-H,HammerDB 运行成本低,操作简单, 是服务器数据库压力测试
的很好选择。
• HammerDB 通过模拟 批发商的货物管理环境,实现了 TPC-C 测试模型,即在线事务处理(OLTP)的基准测试模型。测试结果由 TPC-C 吞吐率衡量,标准测试模型中
的单位是 tpmC(在 在 B HammerDB 是 中,测试结果的单位是 tpm,不是 tpmC。m tpm 表示每分钟的事务交易数量,tpmC 是 TPC-C 的事务交易单位)。
• HammerDB 通过模拟供应商和采购商之间的交易行为,实现了 TPC-H 测试模型,即在线分析处理(OLAP)的基准测试模型。测试结果由 TPCH Power 来衡量,该值
与数据量和交易平均时间有关,表示一小时内能够完成的复杂交易的数量。
关于 TPC-C 和 TPC-H 的详细介绍请参考 TPC 官方网站(http://www.tpc.org/)
✨ 2.2 创建容器docker pull techerwang/oracle:centos76
docker rm -f jemhammerdb
docker run -d --name jemhammerdb -h jemhammerdb \
-p 34389:3389 -p 42222:22 \
techerwang/oracle:centos76 init
docker exec -it jemhammerdb bash
✨ 2.3 Linux 下安装
wget https://github.com/TPC-Council/HammerDB/releases/download/v4.0/HammerDB-4.0-Linux.tar.gz
[root@jeames ~]# tar -zxvf HammerDB-4.0-Linux.tar.gz -C /usr/local/
[root@jeames ~]# cd /usr/local/HammerDB-4.0
[root@jeames HammerDB-4.0]# ./hammerdbcli
HammerDB CLI v4.0
Copyright (C) 2003-2020 Steve Shaw
Type "help" for a list of commands
The xml is well-formed, applying configuration
hammerdb>
hammerdb>help
HammerDB v4.0 CLI Help Index
Type "help command" for more details on specific commands below
buildschema
clearscript
customscript
datagenrun
dbset
dgset
diset
distributescript
librarycheck
loadscript
print
quit
runtimer
switchmode
vucomplete
vucreate
vudestroy
vurun
vuset
vustatus
waittocomplete
✨ 2.4 相关校验
hammerdb>librarycheck
Checking database library for Oracle
Error: failed to load Oratcl - can't read "env(ORACLE_HOME)": no such variable
Ensure that Oracle client libraries are installed and the location in the LD_LIBRARY_PATH environment variable
Checking database library for MSSQLServer
Error: failed to load tdbc::odbc - couldn't load file "libiodbc.so": libiodbc.so: cannot open shared object file: No such file or directory
Ensure that MSSQLServer client libraries are installed and the location in the LD_LIBRARY_PATH environment variable
Checking database library for Db2
Error: failed to load db2tcl - couldn't load file "/usr/local/HammerDB-4.0/lib/db2tcl2.0.0/libdb2tcl.so.0.0.1": libdb2.so.1: cannot open shared object file: No such file or directory
Ensure that Db2 client libraries are installed and the location in the LD_LIBRARY_PATH environment variable
Checking database library for MySQL
Success ... loaded library mysqltcl for MySQL
Checking database library for PostgreSQL
Error: failed to load Pgtcl - couldn't load file "/usr/local/HammerDB-4.0/lib/pgtcl2.1.1/libpgtcl2.1.1.so": libpq.so.5: cannot open shared object file: No such file or directory
Ensure that PostgreSQL client libraries are installed and the location in the LD_LIBRARY_PATH environment variable
⛳️3 . HammerDB压测MySQL
1.如果是Windows直接点击hammerdb.bat,如果是Linux需要调用图形化界面
2.windows平台压测,非常耗CPU
## 调用图形化界面
export DISPLAY=192.168.1.1:0.0
echo $DISPLAY
[root@jeames ~]# cd /usr/local/HammerDB-4.0
[root@jemhammerdb HammerDB-4.0]# ./hammerdb
注:生产环境压测,建议仓库数不少于100
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mes_db |
| mysql |
| performance_schema |
| sbtest |
| sys |
| tpcc |
+--------------------+
7 rows in set (0.00 sec)
mysql> use tpcc
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
mysql> show tables;
+----------------+
| Tables_in_tpcc |
+----------------+
| customer |
| district |
| history |
| item |
| new_order |
| order_line |
| orders |
| stock |
| warehouse |
+----------------+
9 rows in set (0.00 sec)
select a.SCHEMA_NAME, a.DEFAULT_CHARACTER_SET_NAME,a.DEFAULT_COLLATION_NAME,
sum(table_rows) as '记录数',
sum(truncate(data_length/1024/1024, 2)) as '数据容量(MB)',
sum(truncate(index_length/1024/1024, 2)) as '索引容量(MB)',
sum(truncate((data_length+index_length)/1024/1024, 2)) as '总大小(MB)',
sum(truncate(max_data_length/1024/1024, 2)) as '最大值(MB)',
sum(truncate(data_free/1024/1024, 2)) as '空闲空间(MB)'
from INFORMATION_SCHEMA.SCHEMATA a
left outer join information_schema.tables b
on a.SCHEMA_NAME=b.TABLE_SCHEMA
group by a.SCHEMA_NAME, a.DEFAULT_CHARACTER_SET_NAME,a.DEFAULT_COLLATION_NAME
order by sum(data_length) desc, sum(index_length) desc;
mysql> show processlist;
到此这篇关于MySQL压测神器HammerDB的部署及使用的文章就介绍到这了,更多相关mysql 压测神器HammerDB内容请搜索易知道(ezd.cc)以前的文章或继续浏览下面的相关文章希望大家以后多多支持易知道(ezd.cc)!