MySQL压测神器HammerDB的部署及使用详解 目录 前言 ️ 1. HammerDB简介 ️ 2. 容器部署 2.1 镜像下载 2.2 创建容器 2.3 Linux 下安装 2.4 相关校验 ️3 . HammerDB压测MySQL 前言 HammerDB 是一个开源的数据库负载测试和基准测试工具,同时支持 Windows 和 Linux 平台. ️
目录
- 前言
- ️ 1. HammerDB简介
- ️ 2. 容器部署
- 2.1 镜像下载
- 2.2 创建容器
- 2.3 Linux 下安装
- 2.4 相关校验
- ️3 . HammerDB压测MySQL
前言
HammerDB 是一个开源的数据库负载测试和基准测试工具,同时支持 Windows 和 Linux 平台。
️ 1. HammerDB简介
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.1 镜像下载
docker pull techerwang/oracle:centos76
2.2 创建容器
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内容请搜索我们以前的文章或继续浏览下面的相关文章希望大家以后多多支持我们!
本文标题为:MySQL压测神器HammerDB的部署及使用详解
- SQL Server 2022 AlwaysOn新特性之包含可用性组详解 2023-07-29
- redis清除数据 2023-09-13
- 搭建单机Redis缓存服务的实现 2023-07-13
- SQLSERVER调用C#的代码实现 2023-07-29
- Oracle 删除大量表记录操作分析总结 2023-07-23
- Mongodb启动报错完美解决方案:about to fork child process,waiting until server is ready for connections. 2023-07-16
- MySQL8.0.28安装教程详细图解(windows 64位) 2023-07-26
- 在阿里云CentOS 6.8上安装Redis 2023-09-12
- 基于Python制作一个简单的文章搜索工具 2023-07-28
- Numpy中如何创建矩阵并等间隔抽取数据 2023-07-28