This is an automated email from the ASF dual-hosted git repository.
spricoder pushed a commit to branch rel/1.1
in repository https://gitbox.apache.org/repos/asf/iotdb.git
The following commit(s) were added to refs/heads/rel/1.1 by this push:
new a3896e79ff Remove useless class cast and split hit count and request
count of schema cache (#9822)
a3896e79ff is described below
commit a3896e79ffa0241115321b64954584cb3692d41c
Author: ZhangHongYin <[email protected]>
AuthorDate: Tue May 16 11:58:52 2023 +0800
Remove useless class cast and split hit count and request count of schema
cache (#9822)
---
docs/UserGuide/Monitor-Alert/Metric-Tool.md | 5 ++--
docs/zh/UserGuide/Monitor-Alert/Metric-Tool.md | 23 ++++++++--------
.../metrics/metricsets/jvm/JvmMemoryMetrics.java | 6 ++---
.../db/engine/cache/TimeSeriesMetadataCache.java | 7 +++--
.../db/metadata/cache/DataNodeSchemaCache.java | 8 ++++--
.../metadata/cache/DataNodeSchemaCacheMetrics.java | 31 +++++++++++++++++++---
.../mpp/metric/TimeSeriesMetadataCacheMetrics.java | 2 +-
7 files changed, 55 insertions(+), 27 deletions(-)
diff --git a/docs/UserGuide/Monitor-Alert/Metric-Tool.md
b/docs/UserGuide/Monitor-Alert/Metric-Tool.md
index 733792d4f1..063ee10aae 100644
--- a/docs/UserGuide/Monitor-Alert/Metric-Tool.md
+++ b/docs/UserGuide/Monitor-Alert/Metric-Tool.md
@@ -308,9 +308,8 @@ carefully evaluated. The current Core-level metrics are as
follows:
#### 4.2.4. Cache
| Metric | Tags | Type | Description
|
-| --------- | ---------------------------------- | --------- |
------------------------------------------------------------------------ |
+| --------- |------------------------------------| ---------
|--------------------------------------------------------------------------|
| cache_hit | name="chunk" | AutoGauge | The cache hit
ratio of ChunkCache, Unit: % |
-| cache_hit | name="schema" | AutoGauge | The cache hit
ratio of SchemaCache, Unit: % |
| cache_hit | name="timeSeriesMeta" | AutoGauge | The cache hit
ratio of TimeseriesMetadataCache, Unit: % |
| cache_hit | name="bloomFilter" | AutoGauge | The
interception rate of bloomFilter in TimeseriesMetadataCache, Unit: % |
| cache | name="Database", type="hit" | Counter | The hit number
of Database Cache |
@@ -319,6 +318,8 @@ carefully evaluated. The current Core-level metrics are as
follows:
| cache | name="SchemaPartition", type="all" | Counter | The access
number of SSchemaPartition Cache |
| cache | name="DataPartition", type="hit" | Counter | The hit number
of DataPartition Cache |
| cache | name="DataPartition", type="all" | Counter | The access
number of SDataPartition Cache |
+| cache | name="schemaCache", type="hit" | Counter | The hit number
of Schema Cache |
+| cache | name="schemaCache", type="all" | Counter | The access
number of Schema Cache |
#### 4.2.5. Memory
diff --git a/docs/zh/UserGuide/Monitor-Alert/Metric-Tool.md
b/docs/zh/UserGuide/Monitor-Alert/Metric-Tool.md
index 086c93043e..a817656d23 100644
--- a/docs/zh/UserGuide/Monitor-Alert/Metric-Tool.md
+++ b/docs/zh/UserGuide/Monitor-Alert/Metric-Tool.md
@@ -287,18 +287,19 @@ Core 级别的监控指标在系统运行中默认开启,每一个 Core 级别
#### 4.2.4. 缓存统计
-| Metric | Tags | Type | Description
|
-| --------- | ---------------------------------- | --------- |
------------------------------------------------------- |
-| cache_hit | name="chunk" | AutoGauge |
ChunkCache的命中率,单位为% |
-| cache_hit | name="schema" | AutoGauge |
SchemaCache的命中率,单位为% |
-| cache_hit | name="timeSeriesMeta" | AutoGauge |
TimeseriesMetadataCache的命中率,单位为% |
+| Metric | Tags | Type | Description
|
+| --------- | ---------------------------------- | ---------
|-----------------------------------------------|
+| cache_hit | name="chunk" | AutoGauge |
ChunkCache的命中率,单位为% |
+| cache_hit | name="timeSeriesMeta" | AutoGauge |
TimeseriesMetadataCache的命中率,单位为% |
| cache_hit | name="bloomFilter" | AutoGauge |
TimeseriesMetadataCache中的bloomFilter的拦截率,单位为% |
-| cache | name="Database", type="hit" | Counter | Database Cache
的命中次数 |
-| cache | name="Database", type="all" | Counter | Database Cache
的访问次数 |
-| cache | name="SchemaPartition", type="hit" | Counter | SchemaPartition
Cache 的命中次数 |
-| cache | name="SchemaPartition", type="all" | Counter | SchemaPartition
Cache 的访问次数 |
-| cache | name="DataPartition", type="hit" | Counter | DataPartition
Cache 的命中次数 |
-| cache | name="DataPartition", type="all" | Counter | DataPartition
Cache 的访问次数 |
+| cache | name="Database", type="hit" | Counter | Database Cache
的命中次数 |
+| cache | name="Database", type="all" | Counter | Database Cache
的访问次数 |
+| cache | name="SchemaPartition", type="hit" | Counter | SchemaPartition
Cache 的命中次数 |
+| cache | name="SchemaPartition", type="all" | Counter | SchemaPartition
Cache 的访问次数 |
+| cache | name="DataPartition", type="hit" | Counter | DataPartition
Cache 的命中次数 |
+| cache | name="DataPartition", type="all" | Counter | DataPartition
Cache 的访问次数 |
+| cache | name="schemaCache", type="hit" | Counter | Schema Cache
的命中次数 |
+| cache | name="schemaCache", type="all" | Counter | Schema Cache
的访问次数 |
#### 4.2.5. 内存统计
diff --git
a/metrics/interface/src/main/java/org/apache/iotdb/metrics/metricsets/jvm/JvmMemoryMetrics.java
b/metrics/interface/src/main/java/org/apache/iotdb/metrics/metricsets/jvm/JvmMemoryMetrics.java
index 4e5f549ea0..efef8aae98 100644
---
a/metrics/interface/src/main/java/org/apache/iotdb/metrics/metricsets/jvm/JvmMemoryMetrics.java
+++
b/metrics/interface/src/main/java/org/apache/iotdb/metrics/metricsets/jvm/JvmMemoryMetrics.java
@@ -69,7 +69,7 @@ public class JvmMemoryMetrics implements IMetricSet {
"jvm_memory_used_bytes",
MetricLevel.CORE,
memoryPoolBean,
- (mem) -> (long) JvmUtils.getUsageValue(mem, MemoryUsage::getUsed),
+ (mem) -> JvmUtils.getUsageValue(mem, MemoryUsage::getUsed),
"id",
memoryPoolBean.getName(),
"area",
@@ -79,7 +79,7 @@ public class JvmMemoryMetrics implements IMetricSet {
"jvm_memory_committed_bytes",
MetricLevel.CORE,
memoryPoolBean,
- (mem) -> (long) JvmUtils.getUsageValue(mem,
MemoryUsage::getCommitted),
+ (mem) -> JvmUtils.getUsageValue(mem, MemoryUsage::getCommitted),
"id",
memoryPoolBean.getName(),
"area",
@@ -89,7 +89,7 @@ public class JvmMemoryMetrics implements IMetricSet {
"jvm_memory_max_bytes",
MetricLevel.CORE,
memoryPoolBean,
- (mem) -> (long) JvmUtils.getUsageValue(mem, MemoryUsage::getMax),
+ (mem) -> JvmUtils.getUsageValue(mem, MemoryUsage::getMax),
"id",
memoryPoolBean.getName(),
"area",
diff --git
a/server/src/main/java/org/apache/iotdb/db/engine/cache/TimeSeriesMetadataCache.java
b/server/src/main/java/org/apache/iotdb/db/engine/cache/TimeSeriesMetadataCache.java
index 89b7d52fa3..25a2a6b4f6 100644
---
a/server/src/main/java/org/apache/iotdb/db/engine/cache/TimeSeriesMetadataCache.java
+++
b/server/src/main/java/org/apache/iotdb/db/engine/cache/TimeSeriesMetadataCache.java
@@ -238,12 +238,11 @@ public class TimeSeriesMetadataCache {
return entryAverageSize.get();
}
- public long calculateBloomFilterHitRatio() {
+ public double calculateBloomFilterHitRatio() {
if (bloomFilterRequestCount.get() == 0L) {
- return 1L;
+ return 1.0d;
}
- return (long)
- ((double) bloomFilterPreventCount.get() / (double)
bloomFilterRequestCount.get() * 100L);
+ return bloomFilterPreventCount.get() * 100.0d /
bloomFilterRequestCount.get();
}
/** clear LRUCache. */
diff --git
a/server/src/main/java/org/apache/iotdb/db/metadata/cache/DataNodeSchemaCache.java
b/server/src/main/java/org/apache/iotdb/db/metadata/cache/DataNodeSchemaCache.java
index 9547ddab02..5c80c37b34 100644
---
a/server/src/main/java/org/apache/iotdb/db/metadata/cache/DataNodeSchemaCache.java
+++
b/server/src/main/java/org/apache/iotdb/db/metadata/cache/DataNodeSchemaCache.java
@@ -73,8 +73,12 @@ public class DataNodeSchemaCache {
MetricService.getInstance().addMetricSet(new
DataNodeSchemaCacheMetrics(this));
}
- public double getHitRate() {
- return dualKeyCache.stats().hitRate() * 100;
+ public long getHitCount() {
+ return dualKeyCache.stats().hitCount();
+ }
+
+ public long getRequestCount() {
+ return dualKeyCache.stats().requestCount();
}
public static DataNodeSchemaCache getInstance() {
diff --git
a/server/src/main/java/org/apache/iotdb/db/metadata/cache/DataNodeSchemaCacheMetrics.java
b/server/src/main/java/org/apache/iotdb/db/metadata/cache/DataNodeSchemaCacheMetrics.java
index 6af1216dd5..7a8fadc242 100644
---
a/server/src/main/java/org/apache/iotdb/db/metadata/cache/DataNodeSchemaCacheMetrics.java
+++
b/server/src/main/java/org/apache/iotdb/db/metadata/cache/DataNodeSchemaCacheMetrics.java
@@ -38,18 +38,41 @@ public class DataNodeSchemaCacheMetrics implements
IMetricSet {
@Override
public void bindTo(AbstractMetricService metricService) {
metricService.createAutoGauge(
- Metric.CACHE_HIT.toString(),
+ Metric.CACHE.toString(),
MetricLevel.IMPORTANT,
dataNodeSchemaCache,
- o -> (long) o.getHitRate(),
+ DataNodeSchemaCache::getHitCount,
Tag.NAME.toString(),
- "schemaCache");
+ "SchemaCache",
+ Tag.TYPE.toString(),
+ "hit");
+ metricService.createAutoGauge(
+ Metric.CACHE.toString(),
+ MetricLevel.IMPORTANT,
+ dataNodeSchemaCache,
+ DataNodeSchemaCache::getRequestCount,
+ Tag.NAME.toString(),
+ "SchemaCache",
+ Tag.TYPE.toString(),
+ "all");
}
@Override
public void unbindFrom(AbstractMetricService metricService) {
metricService.remove(
- MetricType.AUTO_GAUGE, Metric.CACHE_HIT.toString(),
Tag.NAME.toString(), "schemaCache");
+ MetricType.AUTO_GAUGE,
+ Metric.CACHE.toString(),
+ Tag.NAME.toString(),
+ "SchemaCache",
+ Tag.TYPE.toString(),
+ "hit");
+ metricService.remove(
+ MetricType.AUTO_GAUGE,
+ Metric.CACHE.toString(),
+ Tag.NAME.toString(),
+ "SchemaCache",
+ Tag.TYPE.toString(),
+ "all");
}
@Override
diff --git
a/server/src/main/java/org/apache/iotdb/db/mpp/metric/TimeSeriesMetadataCacheMetrics.java
b/server/src/main/java/org/apache/iotdb/db/mpp/metric/TimeSeriesMetadataCacheMetrics.java
index 07d9b7f57b..0f7c8bc0af 100644
---
a/server/src/main/java/org/apache/iotdb/db/mpp/metric/TimeSeriesMetadataCacheMetrics.java
+++
b/server/src/main/java/org/apache/iotdb/db/mpp/metric/TimeSeriesMetadataCacheMetrics.java
@@ -43,7 +43,7 @@ public class TimeSeriesMetadataCacheMetrics implements
IMetricSet {
Metric.CACHE_HIT.toString(),
MetricLevel.IMPORTANT,
timeSeriesMetadataCache,
- l -> (long)
timeSeriesMetadataCache.calculateTimeSeriesMetadataHitRatio(),
+ l -> timeSeriesMetadataCache.calculateTimeSeriesMetadataHitRatio(),
Tag.NAME.toString(),
"timeSeriesMeta");
metricService.createAutoGauge(