当前位置:网站首页>【云原生】-MySQL压测神器HammerDB的部署及使用
【云原生】-MySQL压测神器HammerDB的部署及使用
2022-08-08 15:34:00 【IT邦德】
哈喽!大家好,我是【IT邦德】,江湖人称jeames007,10年DBA工作经验
一位上进心十足的【大数据领域博主】!
中国DBA联盟(ACDU)成员,目前从事DBA及程序编程
擅长主流数据Oracle、MySQL、PG 运维开发,备份恢复,安装迁移,性能优化、故障应急处理等。
如果有对【数据库】感兴趣的【小可爱】,欢迎关注【IT邦德】
️️️感谢各位大可爱小可爱!️️️
前言
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
[[email protected] ~]# tar -zxvf HammerDB-4.0-Linux.tar.gz -C /usr/local/
[[email protected] ~]# cd /usr/local/HammerDB-4.0
[[email protected] 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
[[email protected] ~]# cd /usr/local/HammerDB-4.0
[[email protected] 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的体验流程|【华为云至简致远】
如何使用 Eolink 实现 API 文档自动生成
企业开发小程序有什么优势?为什么要开发小程序?
全网首发!消息中间件神仙笔记,涵盖阿里十年技术精髓
第一章、RPC 基础知识
Take you to play with the "Super Cup" ECS features and experiment on the pit [HUAWEI CLOUD is simple and far]
Guanghong Technology: The company provides manufacturing services for Xiaomi, Samsung, OPPO, Nokia and other products in India
保险,一生必备
[Online interviewer] How to achieve deduplication and idempotency
Streamsets Data Collector 3.12
随机推荐
返回分页查询分类并统计多对多关系表中各分类下的应用数量
把酒言欢话聊天,基于Vue3.0+Tornado6.1+Redis发布订阅(pubsub)模式打造异步非阻塞(aioredis)实时(websocket)通信聊天系统
腾讯又一长达 8 年的服务下架。。。
第一章、RPC 基础知识
面试题 17.05. 字母与数字
深度学习-神经网络原理1
(1)通过FlinkSQL将数据写入mysql demo
Synergistic authors open source throttling, 2022 trend of technology foresight (asynchronous programming/container technology)
【愚公系列】华为云云数据库MySQL的体验流程|【华为云至简致远】
JS-BOM-factorial calculation
codeforces 444C DZY Loves Colors
《流浪方舟》首发重现,点我试玩
C#/VB.NET convert PDF to PDF/X-1a:2001
京东T9纯手打688页神笔记,SSM框架整合Redis搭建高效互联网应用
What is low-code development?Is everyone really optimistic about low-code development?
深度学习中的常见正则化方法(Regularization)以及优化器中的WeightDecay参数详解
bzoj2816 [ZJOI2012]网络
小实验:实现一个用于计算(包括加减乘除)的小程序
想要精准营销,从学习搭建一套对的标签体系开始丨 DTVision 分析洞察篇
leetcode/回文子字符串的个数