Skip to content

Commit

Permalink
feat: support global stat env
Browse files Browse the repository at this point in the history
  • Loading branch information
mrdrivingduck authored and polardb-bot[bot] committed Apr 14, 2024
1 parent 5ca82d6 commit 7de734f
Show file tree
Hide file tree
Showing 11 changed files with 355 additions and 38 deletions.
118 changes: 118 additions & 0 deletions docs/contributing/trouble-issuing.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
polar_stat_env
--------------------------------------------------------------------
{ +
"Role": "Primary", +
"CPU": { +
"Architecture": "x86_64", +
"Model Name": "Intel(R) Xeon(R) Platinum 8369B CPU @ 2.70GHz",+
Expand All @@ -36,3 +37,120 @@
}
(1 row)
```

通过 ePQ 功能可以直接获取整个集群中所有计算节点的硬件配置信息:

```sql:no-line-numbers
=> CREATE EXTENSION polar_stat_env;
=> SET polar_enable_px TO ON;
=> SET polar_px_use_master TO ON;
=> SET polar_px_use_standby TO ON;
=> SELECT * FROM polar_global_function('polar_stat_env');
polar_stat_env
---------------------------------------------------------------------
{ +
"Role": "Standby", +
"CPU": { +
"Architecture": "x86_64", +
"Model Name": "Intel(R) Xeon(R) Platinum 8269CY CPU @ 2.50GHz",+
"CPU Cores": "104", +
"CPU Thread Per Cores": "2", +
"CPU Core Per Socket": "26", +
"NUMA Nodes": "2", +
"L1d cache": "32K", +
"L1i cache": "32K", +
"L2 cache": "1024K", +
"L3 cache": "36608K" +
}, +
"Memory": { +
"Memory Total (GB)": "754", +
"HugePage Size (MB)": "2", +
"HugePage Total Size (GB)": "42" +
}, +
"OS Params": { +
"OS": "5.10.134-16.1.al8.x86_64", +
"Swappiness(1-100)": "0", +
"Vfs Cache Pressure(0-1000)": "500", +
"Min Free KBytes(KB)": "20971520" +
} +
}
{ +
"Role": "Replica", +
"CPU": { +
"Architecture": "x86_64", +
"Model Name": "Intel(R) Xeon(R) Platinum 8269CY CPU @ 2.50GHz",+
"CPU Cores": "104", +
"CPU Thread Per Cores": "2", +
"CPU Core Per Socket": "26", +
"NUMA Nodes": "2", +
"L1d cache": "32K", +
"L1i cache": "32K", +
"L2 cache": "1024K", +
"L3 cache": "36608K" +
}, +
"Memory": { +
"Memory Total (GB)": "754", +
"HugePage Size (MB)": "2", +
"HugePage Total Size (GB)": "42" +
}, +
"OS Params": { +
"OS": "5.10.134-16.1.al8.x86_64", +
"Swappiness(1-100)": "0", +
"Vfs Cache Pressure(0-1000)": "500", +
"Min Free KBytes(KB)": "20971520" +
} +
}
{ +
"Role": "Primary", +
"CPU": { +
"Architecture": "x86_64", +
"Model Name": "Intel(R) Xeon(R) Platinum 8269CY CPU @ 2.50GHz",+
"CPU Cores": "104", +
"CPU Thread Per Cores": "2", +
"CPU Core Per Socket": "26", +
"NUMA Nodes": "2", +
"L1d cache": "32K", +
"L1i cache": "32K", +
"L2 cache": "1024K", +
"L3 cache": "36608K" +
}, +
"Memory": { +
"Memory Total (GB)": "754", +
"HugePage Size (MB)": "2", +
"HugePage Total Size (GB)": "42" +
}, +
"OS Params": { +
"OS": "5.10.134-16.1.al8.x86_64", +
"Swappiness(1-100)": "0", +
"Vfs Cache Pressure(0-1000)": "500", +
"Min Free KBytes(KB)": "20971520" +
} +
}
{ +
"Role": "Replica", +
"CPU": { +
"Architecture": "x86_64", +
"Model Name": "Intel(R) Xeon(R) Platinum 8269CY CPU @ 2.50GHz",+
"CPU Cores": "104", +
"CPU Thread Per Cores": "2", +
"CPU Core Per Socket": "26", +
"NUMA Nodes": "2", +
"L1d cache": "32K", +
"L1i cache": "32K", +
"L2 cache": "1024K", +
"L3 cache": "36608K" +
}, +
"Memory": { +
"Memory Total (GB)": "754", +
"HugePage Size (MB)": "2", +
"HugePage Total Size (GB)": "42" +
}, +
"OS Params": { +
"OS": "5.10.134-16.1.al8.x86_64", +
"Swappiness(1-100)": "0", +
"Vfs Cache Pressure(0-1000)": "500", +
"Min Free KBytes(KB)": "20971520" +
} +
}
(4 rows)
```
118 changes: 118 additions & 0 deletions docs/zh/contributing/trouble-issuing.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
polar_stat_env
--------------------------------------------------------------------
{ +
"Role": "Primary", +
"CPU": { +
"Architecture": "x86_64", +
"Model Name": "Intel(R) Xeon(R) Platinum 8369B CPU @ 2.70GHz",+
Expand All @@ -36,3 +37,120 @@
}
(1 row)
```

通过 ePQ 功能可以直接获取整个集群中所有计算节点的硬件配置信息:

```sql:no-line-numbers
=> CREATE EXTENSION polar_stat_env;
=> SET polar_enable_px TO ON;
=> SET polar_px_use_master TO ON;
=> SET polar_px_use_standby TO ON;
=> SELECT * FROM polar_global_function('polar_stat_env');
polar_stat_env
---------------------------------------------------------------------
{ +
"Role": "Standby", +
"CPU": { +
"Architecture": "x86_64", +
"Model Name": "Intel(R) Xeon(R) Platinum 8269CY CPU @ 2.50GHz",+
"CPU Cores": "104", +
"CPU Thread Per Cores": "2", +
"CPU Core Per Socket": "26", +
"NUMA Nodes": "2", +
"L1d cache": "32K", +
"L1i cache": "32K", +
"L2 cache": "1024K", +
"L3 cache": "36608K" +
}, +
"Memory": { +
"Memory Total (GB)": "754", +
"HugePage Size (MB)": "2", +
"HugePage Total Size (GB)": "42" +
}, +
"OS Params": { +
"OS": "5.10.134-16.1.al8.x86_64", +
"Swappiness(1-100)": "0", +
"Vfs Cache Pressure(0-1000)": "500", +
"Min Free KBytes(KB)": "20971520" +
} +
}
{ +
"Role": "Replica", +
"CPU": { +
"Architecture": "x86_64", +
"Model Name": "Intel(R) Xeon(R) Platinum 8269CY CPU @ 2.50GHz",+
"CPU Cores": "104", +
"CPU Thread Per Cores": "2", +
"CPU Core Per Socket": "26", +
"NUMA Nodes": "2", +
"L1d cache": "32K", +
"L1i cache": "32K", +
"L2 cache": "1024K", +
"L3 cache": "36608K" +
}, +
"Memory": { +
"Memory Total (GB)": "754", +
"HugePage Size (MB)": "2", +
"HugePage Total Size (GB)": "42" +
}, +
"OS Params": { +
"OS": "5.10.134-16.1.al8.x86_64", +
"Swappiness(1-100)": "0", +
"Vfs Cache Pressure(0-1000)": "500", +
"Min Free KBytes(KB)": "20971520" +
} +
}
{ +
"Role": "Primary", +
"CPU": { +
"Architecture": "x86_64", +
"Model Name": "Intel(R) Xeon(R) Platinum 8269CY CPU @ 2.50GHz",+
"CPU Cores": "104", +
"CPU Thread Per Cores": "2", +
"CPU Core Per Socket": "26", +
"NUMA Nodes": "2", +
"L1d cache": "32K", +
"L1i cache": "32K", +
"L2 cache": "1024K", +
"L3 cache": "36608K" +
}, +
"Memory": { +
"Memory Total (GB)": "754", +
"HugePage Size (MB)": "2", +
"HugePage Total Size (GB)": "42" +
}, +
"OS Params": { +
"OS": "5.10.134-16.1.al8.x86_64", +
"Swappiness(1-100)": "0", +
"Vfs Cache Pressure(0-1000)": "500", +
"Min Free KBytes(KB)": "20971520" +
} +
}
{ +
"Role": "Replica", +
"CPU": { +
"Architecture": "x86_64", +
"Model Name": "Intel(R) Xeon(R) Platinum 8269CY CPU @ 2.50GHz",+
"CPU Cores": "104", +
"CPU Thread Per Cores": "2", +
"CPU Core Per Socket": "26", +
"NUMA Nodes": "2", +
"L1d cache": "32K", +
"L1i cache": "32K", +
"L2 cache": "1024K", +
"L3 cache": "36608K" +
}, +
"Memory": { +
"Memory Total (GB)": "754", +
"HugePage Size (MB)": "2", +
"HugePage Total Size (GB)": "42" +
}, +
"OS Params": { +
"OS": "5.10.134-16.1.al8.x86_64", +
"Swappiness(1-100)": "0", +
"Vfs Cache Pressure(0-1000)": "500", +
"Min Free KBytes(KB)": "20971520" +
} +
}
(4 rows)
```
5 changes: 3 additions & 2 deletions external/polar_stat_env/polar_stat_env--1.0.sql
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
-- Create customized polar stat env func
CREATE FUNCTION polar_stat_env(
IN format text DEFAULT 'json'
) RETURNS TEXT
)
RETURNS SETOF TEXT
AS 'MODULE_PATHNAME', 'polar_stat_env'
LANGUAGE C PARALLEL SAFE;

CREATE FUNCTION polar_stat_env_no_format(
IN format text DEFAULT 'json'
)
RETURNS TEXT
RETURNS SETOF TEXT
AS 'MODULE_PATHNAME', 'polar_stat_env_no_format'
LANGUAGE C PARALLEL SAFE;
Loading

0 comments on commit 7de734f

Please sign in to comment.