openGauss数据库维护管理指导(三)

上期我们介绍了openGauss数据库操作系统参数检查、健康状态检查,本期继续介绍数据库性能检查。

3.数据库性能检查

3.1 实验介绍

3.1.1 关于本实验

openGauss 不仅提供了gs_checkperf工具来帮助用户了解openGauss的负载情况。

本实验主要是通过gs_checkperf工具来检查openGauss数据库性能以及通过EXPLAIN来进行SQL语句优化。

3.1.2 实验目的

掌握gs_checkperf工具的基本使用

3.2 通过gs_checkperf工具来检查数据库性能

说明:

gs_checkperf可以对以下级别进行检查:

openGauss级别(主机CPU占用率、Gauss CPU占用率、I/O使用情况等)

节点级别(CPU使用情况、内存使用情况、I/O使用情况)

会话/进程级别(CPU使用情况、内存使用情况、I/O使用情况)

SSD性能(写入、读取性能)

其中检查SSD性能要用root用户执行,检查openGauss性能要用openGauss安装用户执行

本实验为检查openGauss性能。

步骤 1 用root用户登录装有openGauss数据库服务的操作系统然后用 su - omm命令切换至omm用户环境,登录后信息如下。

Welcome to 4.19.90-2003.4.0.0036.oe1.aarch64

System information as of time: Tue Jul 21 09:21:11 CST 2020

System load: 0.01

Processes: 109

Memory used: 6.7%

Swap used: 0.0%

Usage On: 15%

IP address: 192.168.0.96

Users online: 1

[root@ecs-e1b3 ~]# su - omm

Last login: Fri Jul 10 19:05:39 CST 2020 on pts/0

Welcome to 4.19.90-2003.4.0.0036.oe1.aarch64

System information as of time: Tue Jul 21 09:21:25 CST 2020

System load: 0.01

Processes: 111

Memory used: 7.0%

Swap used: 0.0%

Usage On: 15%

IP address: 192.168.0.96

Users online: 1

[omm@ecs-e1b3 ~]$

步骤 2 先启动数据库服务,再用gs_checkperf检查下,再使用gsql客户端以管理员用户身份连接postgres数据库,假设端口号为26000。

先启动数据库服务。

[omm@ecs-e1b3 ~]$ gs_om -t start;

Starting cluster.

=========================================

=========================================

Successfully started.

用gs_checkperf检查下。

[omm@ecs-e1b3 ~]$ gs_checkperf

Cluster statistics information:

Host CPU busy time ratio : .72 %

MPPDB CPU time % in busy time : .33 %

Shared Buffer Hit ratio : 97.33 %

In-memory sort ratio : 0

Physical Reads : 466

Physical Writes : 175

DB size : 47 MB

Total Physical writes : 175

Active SQL count : 3

Session count : 4

确认openGauss数据库服务是否正常。

[omm@ecs-e1b3 ~]$ gs_om -t status;

----------------------------------------------------------------------

cluster_state : Unavailable

redistributing : No

----------------------------------------------------------------------

cluster_state : Normal 表示已启动,可以正常使用。如果状态为Unavailable表示不可用

为了实验继续进行,请先启动数据库服务。

启动数据库服务(如果数据库服务是正常的,此步骤可以不执行)。

[omm@ecs-e1b3 ~]$ gs_om -t start;

Starting cluster.

=========================================

=========================================

Successfully started.

然后连接postgres数据库。

[omm@ecs-e1b3 ~]$ gsql -d postgres -p 26000 -r

gsql ((openGauss 1.1.0 build 38a9312a) compiled at 2020-05-27 14:57:08 commit 472 last mr 549 )

Non-SSL connection (SSL connection is recommended when requiring high-security)

Type "help" for help.

postgres=#

步骤 3 对PMK模式下的表进行统计信息收集。

postgres=# **yze pmk.pmk_configuration; 

**YZE

postgres=# **yze pmk.pmk_meta_data;

**YZE

postgres=# **yze pmk.pmk_snapshot;

**YZE

postgres=# **yze pmk.pmk_snapshot_datanode_stat;

**YZE

postgres=#

说明:

gs_checkperf工具的监控信息依赖于pmk模式下的表的数据,如果pmk模式下的表未执行**yze操作,则可能导致gs_checkperf工具执行失败。

步骤 4 执行简要性能检查。

用 \q 先退出postgres数据库,然后在操作系统用户 omm 环境下去执行gs_checkperf检查工具,具体如下:

postgres=# 

postgres=# \q

[omm@ecs-e1b3 ~]$ gs_checkperf

Cluster statistics information:

Host CPU busy time ratio : 1.66 % -----主机CPU占用率

MPPDB CPU time % in busy time : 2.51 % ----Gauss CPU占用率

Shared Buffer Hit ratio : 99.14 % ----共享内存命中率

In-memory sort ratio : 0 ---内存中排序比率

Physical Reads : 504 ---物理读次数

Physical Writes : 162 ---物理写次数

DB size : 57 MB ---DB大小 

Total Physical writes : 162 ---总物理写次数

Active SQL count : 4 ---当前SQL执行数

Session count : 5 ---Session数量

步骤 5 执行详细性能检查。

[omm@ecs-e1b3 ~]$ gs_checkperf --detail

Cluster statistics information:

Host CPU usage rate:

Host total CPU time : 45719980.000 Jiffies

Host CPU busy time : 761060.000 Jiffies

Host CPU iowait time : 6640.000 Jiffies

Host CPU busy time ratio : 1.66 %

Host CPU iowait time ratio : .01 %

MPPDB CPU usage rate:

MPPDB CPU time % in busy time : 5.12 %

MPPDB CPU time % in total time : .09 %

Shared buffer hit rate:

Shared Buffer Reads : 1057

Shared Buffer Hits : 139798

Shared Buffer Hit ratio : 99.25 %

In memory sort rate:

In-memory sort count : 0

In-disk sort count : 0

In-memory sort ratio : 0

I/O usage:

Number of files : 106

Physical Reads : 584

Physical Writes : 362

Read Time : 5794 ms

Write Time : 4046 ms

Disk usage:

DB size : 57 MB

Total Physical writes : 362

Average Physical write : 89471.08

Maximum Physical write : 362

Activity statistics:

Active SQL count : 4

Session count : 5

Node statistics information:

dn_6001:

MPPDB CPU Time : 38960 Jiffies

Host CPU Busy Time : 761060 Jiffies

Host CPU Total Time : 45719980 Jiffies

MPPDB CPU Time % in Busy Time : 5.12 %

MPPDB CPU Time % in Total Time : .09 %

Physical memory : 7144341504 Bytes

DB Memory usage : 14922285056 Bytes

Shared buffer size : 1073741824 Bytes

Shared buffer hit ratio : 99.25 %

Sorts in memory : 0

Sorts in disk : 0

In-memory sort ratio : 0

Number of files : 106

Physical Reads : 584

Physical Writes : 362

Read Time : 5794

Write Time : 4046

Session statistics information(Top 10):

Session CPU statistics:

1 dn_6001-postgres-omm:

Session CPU time : 2

Database CPU time : 39020

Session CPU time % : .01 %

……………

Session Memory statistics:

1 dn_6001-postgres-omm:

Buffer Reads : 1309

Shared Buffer Hit ratio : 93.03

In Memory sorts : 0

In Disk sorts : 0

In Memory sorts ratio : 0

Total Memory Size : 7433136

Used Memory Size : 6443268

………………..

Session IO statistics:

1 dn_6001-postgres-omm:

Physical Reads : 98

Read Time : 1069

2 dn_6001-postgres-omm:

Physical Reads : 13

Read Time : 173

……….........

[omm@ecs-e1b3 ~]$

gs_checkperf 检查实验结束。

©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 200,841评论 5 472
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 84,415评论 2 377
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 147,904评论 0 333
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 54,051评论 1 272
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 63,055评论 5 363
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 48,255评论 1 278
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 37,729评论 3 393
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 36,377评论 0 255
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 40,517评论 1 294
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 35,420评论 2 317
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 37,467评论 1 329
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 33,144评论 3 317
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 38,735评论 3 303
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 29,812评论 0 19
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 31,029评论 1 256
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 42,528评论 2 346
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 42,126评论 2 341

推荐阅读更多精彩内容