[转帖]sysbench压测postgresql(mysql同理)

sysbench,postgresql,mysql,同理 · 浏览次数 : 0

小编点评

**内容生成知识点** * PostgreSQL技能树SQL高级技巧递归查询5025 * 使用上述命令,sysbench工具会根据你的指令构造出各种各样的SQL语句去更新或查询1张测试表里的数据 * urma执行cleanup命令,清理数据 **内容生成文章** **PGSQL数据库压测性能分析** * sysbench工具可以帮助你分析数据库的压测性能指标 * urma执行cleanup命令,清理数据 **PGSQL数据库压测测试工具** * oltp_read_write工具可以帮助你对数据库进行压测测试 * 使用该工具,可以执行以下各种操作: * 更新数据库的表 * 查询数据库的表 * 更新数据库的表 * 查询数据库的表 **PGSQL数据库压测测试工具示例** ```sql pt_read_write --db-ps-mode=disable --cleanup --table_size=1000000 oltp_read_write --db-ps-mode=disable --time=1 --threads=1000 --report-interval=5 --pgsql-host=192.168.1.35 --pgsql-port=5001 --pgsql-user=testpgs --pgsql-password=123456 --pgsql-db=test_db --tables=1 --table_size=1000000 ``` **其他内容** *greSQL数据库压测性能分析工具可以帮助你分析数据库的压测性能指标 * 使用该工具,可以执行以下各种操作: * 更新数据库的表 * 查询数据库的表 * 更新数据库的表 * 查询数据库的表

正文

准备创建表和数据:sysbench --db-driver=pgsql --time=1 --threads=1000 --report-interval=5 --pgsql-host=192.168.1.35 --pgsql-port=5001 --pgsql-user=testpgs --pgsql-password=123456 --pgsql-db=test_db --tables=1 --table_size=1000000 oltp_read_write --db-ps-mode=disable prepare 测试数据库的只读性能,使用的是oltp_read_only模式:sysbench --db-driver=pgsql --time=1 --threads=1000 --report-interval=5 --pgsql-host=192.168.1.35 --pgsql-port=5001 --pgsql-user=testpgs --pgsql-password=123456 --pgsql-db=test_db --tables=1 --table_size=1000000 oltp_read_only --db-ps-mode=disable run SQL statistics:    queries performed:        read:                            25242        write:                           0        other:                           3606        total:                           28848    transactions:                        1803   (859.40 per sec.)    queries:                             28848  (13750.37 per sec.)    ignored errors:                      0      (0.00 per sec.)    reconnects:                          0      (0.00 per sec.) General statistics:    total time:                          2.0931s    total number of events:              1803 Latency (ms):         min:                                  204.65         avg:                                  865.57         max:                                 1312.73         95th percentile:                     1191.92         sum:                              1560630.86 测试数据库的删除性能,使用的是oltp_delete模式:sysbench --db-driver=pgsql --time=1 --threads=1000 --report-interval=5 --pgsql-host=192.168.1.35 --pgsql-port=5001 --pgsql-user=testpgs --pgsql-password=123456 --pgsql-db=test_db --tables=1 --table_size=1000000 oltp_delete --db-ps-mode=disable run SQL statistics:    queries performed:        read:                            0        write:                           11506        other:                           9290        total:                           20796    transactions:                        20796  (16813.13 per sec.)    queries:                             20796  (16813.13 per sec.)    ignored errors:                      0      (0.00 per sec.)    reconnects:                          0      (0.00 per sec.) General statistics:    total time:                          1.2349s    total number of events:              20796 Latency (ms):         min:                                    3.16         avg:                                   51.30         max:                                  255.24         95th percentile:                       58.92         sum:                              1066896.74  测试数据库的更新索引字段的性能,使用的是oltp_update_index模式:sysbench --db-driver=pgsql --time=1 --threads=1000 --report-interval=5 --pgsql-host=192.168.1.35 --pgsql-port=5001 --pgsql-user=testpgs --pgsql-password=123456 --pgsql-db=test_db --tables=1 --table_size=1000000 oltp_update_index --db-ps-mode=disable run SQL statistics:    queries performed:        read:                            0        write:                           17355        other:                           0        total:                           17355    transactions:                        17355  (14499.51 per sec.)    queries:                             17355  (14499.51 per sec.)    ignored errors:                      0      (0.00 per sec.)    reconnects:                          0      (0.00 per sec.) General statistics:    total time:                          1.1948s    total number of events:              17355 Latency (ms):         min:                                    5.27         avg:                                   61.99         max:                                  244.16         95th percentile:                       75.82         sum:                              1075762.57 测试数据库的更新非索引字段的性能,使用的是oltp_update_non_index模式:sysbench --db-driver=pgsql --time=1 --threads=1000 --report-interval=5 --pgsql-host=192.168.1.35 --pgsql-port=5001 --pgsql-user=testpgs --pgsql-password=123456 --pgsql-db=test_db --tables=1 --table_size=1000000 oltp_update_non_index --db-ps-mode=disable run SQL statistics:    queries performed:        read:                            0        write:                           17801        other:                           0        total:                           17801    transactions:                        17801  (14435.25 per sec.)    queries:                             17801  (14435.25 per sec.)    ignored errors:                      0      (0.00 per sec.)    reconnects:                          0      (0.00 per sec.) General statistics:    total time:                          1.2312s    total number of events:              17801 Latency (ms):         min:                                   13.85         avg:                                   60.14         max:                                  261.74         95th percentile:                       82.96         sum:                              1070611.81 测试数据库的插入性能,使用的是oltp_insert模式:sysbench --db-driver=pgsql --time=1 --threads=1000 --report-interval=5 --pgsql-host=192.168.1.35 --pgsql-port=5001 --pgsql-user=testpgs --pgsql-password=123456 --pgsql-db=test_db --tables=1 --table_size=1000000 oltp_insert --db-ps-mode=disable run SQL statistics:    queries performed:        read:                            0        write:                           19685        other:                           0        total:                           19685    transactions:                        19685  (16335.50 per sec.)    queries:                             19685  (16335.50 per sec.)    ignored errors:                      0      (0.00 per sec.)    reconnects:                          0      (0.00 per sec.) General statistics:    total time:                          1.2000s    total number of events:              19685 Latency (ms):         min:                                    4.49         avg:                                   52.90         max:                                  228.04         95th percentile:                       77.19         sum:                              1041424.34 测试数据库的写入性能,使用的是oltp_write_only模式:sysbench --db-driver=pgsql --time=1 --threads=1000 --report-interval=5 --pgsql-host=192.168.1.35 --pgsql-port=5001 --pgsql-user=testpgs --pgsql-password=123456 --pgsql-db=test_db --tables=1 --table_size=1000000 oltp_write_only --db-ps-mode=disable run SQL statistics:    queries performed:        read:                            0        write:                           17940        other:                           9112        total:                           27052    transactions:                        4480   (3374.72 per sec.)    queries:                             27052  (20377.87 per sec.)    ignored errors:                      43     (32.39 per sec.)    reconnects:                          0      (0.00 per sec.) General statistics:    total time:                          1.3226s    total number of events:              4480 Latency (ms):         min:                                   65.01         avg:                                  248.24         max:                                  702.04         95th percentile:                      314.45         sum:                              1112124.54  测试数据库的综合读写TPS,使用的是oltp_read_write模式sysbench --db-driver=pgsql --time=1 --threads=1000 --report-interval=5 --pgsql-host=192.168.1.35 --pgsql-port=5001 --pgsql-user=testpgs --pgsql-password=123456 --pgsql-db=test_db --tables=1 --table_size=1000000 oltp_read_write --db-ps-mode=disable run SQL statistics:    queries performed:        read:                            25004        write:                           7114        other:                           3588        total:                           35706    transactions:                        1779   (899.49 per sec.)    queries:                             35706  (18053.45 per sec.)    ignored errors:                      7      (3.54 per sec.)    reconnects:                          0      (0.00 per sec.) General statistics:    total time:                          1.9728s    total number of events:              1779 Latency (ms):         min:                                  199.06         avg:                                  854.98         max:                                 1804.89         95th percentile:                     1191.92         sum:                              1521010.69  测试数据库的综合读写TPS,使用的是oltp_read_write模式:sysbench --db-driver=pgsql --time=1 --threads=500 --report-interval=5 --pgsql-host=192.168.1.35 --pgsql-port=5001 --pgsql-user=testpgs --pgsql-password=123456 --pgsql-db=test_db --tables=1 --table_size=1000000 oltp_read_write --db-ps-mode=disable run SQL statistics:    queries performed:        read:                            11704        write:                           3333        other:                           1677        total:                           16714    transactions:                        833    (601.84 per sec.)    queries:                             16714  (12075.74 per sec.)    ignored errors:                      3      (2.17 per sec.)    reconnects:                          0      (0.00 per sec.) General statistics:    total time:                          1.3792s    total number of events:              833 Latency (ms):         min:                                  293.30         avg:                                  731.76         max:                                 1353.39         95th percentile:                     1170.65         sum:                               609554.21 使用上面的命令,sysbench工具会根据你的指令构造出各种各样的SQL语句去更新或者查询1张测试表里的数据,同时监测出数据库的压测性能指标,最后完成压测之后,可以执行下面的cleanup命令,清理数据。sysbench --db-driver=pgsql --time=1 --threads=1000 --report-interval=5 --pgsql-host=192.168.1.35 --pgsql-port=5001 --pgsql-user=testpgs --pgsql-password=123456 --pgsql-db=test_db --tables=1 --table_size=1000000 oltp_read_write --db-ps-mode=disable cleanup
复制

文章参考:

https://www.cnblogs.com/ariesblog/p/13847740.html

https://blog.csdn.net/weixin_39327527/article/details/107528485

文章知识点与官方知识档案匹配,可进一步学习相关知识

与[转帖]sysbench压测postgresql(mysql同理)相似的内容:

[转帖]sysbench压测postgresql(mysql同理)

准备创建表和数据:sysbench --db-driver=pgsql --time=1 --threads=1000 --report-interval=5 --pgsql-host=192.168.1.35 --pgsql-port=5001 --pgsql-user=testpgs --pgs

[转帖]用sysbench压测mysql、postgresql(蟑螂db)对比

mysql: 准备创建表和数据: sysbench --db-driver=mysql --time=10 --threads=10 --report-interval=1 --mysql-host=172.18.44.84 --mysql-port=7999 --mysql-user=zl --m

[转帖]使用sysbench对MySQL进行压力测试

使用sysbench对MySQL进行压力测试 https://cloud.tencent.com/developer/article/2073561 1.背景 ​出自percona公司,是一款多线程系统压测工具,可以根据影响数据库服务器性能的各种因素来评估系统的性能。例如,可以用来测试文件IO,操作

[转帖]sysbench的用法

Build Requirements Windows As of sysbench 1.0 support for native Windows builds was dropped. It may be re-introduced in later versions. Currently, the

[转帖]sysbench安装

https://www.jianshu.com/p/1948beb6699e sysbench是一个多线程的基准测试工具,一般用来评估不同系统参数下的数据库负载情况如果你的环境上如下依赖包都没装上,需要先安装如下这些依赖包,使用yum install更便利 image.png 如果使用源码安装(在网

[转帖]sysbench安装

https://www.jianshu.com/p/1948beb6699e sysbench是一个多线程的基准测试工具,一般用来评估不同系统参数下的数据库负载情况如果你的环境上如下依赖包都没装上,需要先安装如下这些依赖包,使用yum install更便利 image.png 如果使用源码安装(在网

[转帖]Sysbench - 一种系统性能benchmark

SysBench是一款开源的、跨平台的、模块化的、多线程的性能测试工具,通过高负载地运行在数据库上,可以执行CPU/内存/线程/IO/数据库等方面的性能测试。用于评估操作系统的性能参数。 1 sysbench简介 Sysbench使得我们无需采用真正的复杂的数据库benchmark而获取系统的性能概

[转帖]linux sysbench (一): CPU性能测试详解

http://t.zoukankan.com/fzxiaomange-p-sysbench-cpu.html 网上sysbench教材众多,但没有一篇中文教材对cpu测试参数和结果进行详解。本文旨在能够让读者对sysbench的cpu有一定了解。 小慢哥的原创文章,欢迎转载 1.sysbench基础

[转帖]测试工具 sysbench (Centos 7.x) for DM数据库

1、简单介绍 sysbench是一个开源,模块化的多线程性能测试工具,可以用来进行硬件环境性能测试,也可进行数据库的性能测试。但是由于需要支持DM测试,所以我们一般使用源码进行编译。 2、运行方法 sysbench通过运行lua脚本进行数据库测试。而每次测试都分为prepare、run、cleanu

[转帖]用sysbench进行数据库OLTP基准测试

https://www.cnblogs.com/ariesblog/p/13847740.html 基于TPC-C的OLTP基准测试,对比Mysql和PostgreSQL的性能 一、什么是TPC-C和tpmC 1、TPC-C TPC-C是一种旨在衡量联机事务处理(OLTP)系统性能与可伸缩性的行业标