温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

分析PostgreSQL DBA数据库的性能指标变化

发布时间:2021-11-04 11:27:07 来源:亿速云 阅读:242 作者:iii 栏目:关系型数据库

本篇内容主要讲解“分析PostgreSQL DBA数据库的性能指标变化”,感兴趣的朋友不妨来看看。本文介绍的方法操作简单快捷,实用性强。下面就让小编来带大家学习“分析PostgreSQL DBA数据库的性能指标变化”吧!

不同的网络环境(延时)对数据库的性能指标有很大的影响,下面用tc工具来模拟增加网络延时来观察数据库的性能指标变化.

安装tc
使用python的封装工具tcconfig,安装命令:

pip3 install tcconfig

性能测试
网络无延时

[pg12@localhost ~]$ pgbench -S -c 10 -h localhost -T 20 test
starting vacuum...end.
transaction type: <builtin: select only>
scaling factor: 1
query mode: simple
number of clients: 10
number of threads: 1
duration: 20 s
number of transactions actually processed: 298322
latency average = 0.671 ms
tps = 14911.921647 (including connections establishing)
tps = 14916.752171 (excluding connections establishing)

TPS接近15K

网络延时延时10ms
设置网络延时为10ms

tcset --device lo --delay=10 --overwrite

再次测试

[pg12@localhost ~]$ pgbench -S -c 10 -h 192.168.26.28 -T 20 test
starting vacuum...end.
transaction type: <builtin: select only>
scaling factor: 1
query mode: simple
number of clients: 10
number of threads: 1
duration: 20 s
number of transactions actually processed: 8459
latency average = 23.655 ms
tps = 422.736098 (including connections establishing)
tps = 424.325926 (excluding connections establishing)

TPS直接降至400多,差不多只有原来的1/40

网络延时50ms
设置网络延时为50ms

tcset --device lo --delay=50 --overwrite

再次测试

[pg12@localhost ~]$ pgbench -S -c 10 -h 192.168.26.28 -T 20 test
starting vacuum...end.
transaction type: <builtin: select only>
scaling factor: 1
query mode: simple
number of clients: 10
number of threads: 1
duration: 20 s
number of transactions actually processed: 1650
latency average = 121.406 ms
tps = 82.368327 (including connections establishing)
tps = 83.671552 (excluding connections establishing)

这一次结果是80多,差不多是最初的1/200

为什么OLTP分布式数据库的TPS的提升是很难的一个事情,其中一个原因是网络延时.

到此,相信大家对“分析PostgreSQL DBA数据库的性能指标变化”有了更深的了解,不妨来实际操作一番吧!这里是亿速云网站,更多相关内容可以进入相关频道进行查询,关注我们,继续学习!

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI