You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by ha...@apache.org on 2023/04/19 07:52:39 UTC
[iotdb] 03/03: Update userguide
This is an automated email from the ASF dual-hosted git repository.
haonan pushed a commit to branch devicePathCache1
in repository https://gitbox.apache.org/repos/asf/iotdb.git
commit 751803b68c40044039f3ca349b2c42eda64e6474
Author: HTHou <hh...@outlook.com>
AuthorDate: Wed Apr 19 15:29:04 2023 +0800
Update userguide
---
docs/UserGuide/Reference/Common-Config-Manual.md | 11 ++++++++++-
docs/zh/UserGuide/Reference/Common-Config-Manual.md | 9 +++++++++
.../src/assembly/resources/conf/iotdb-common.properties | 4 ++++
.../src/main/java/org/apache/iotdb/db/conf/IoTDBConfig.java | 10 ++++++++++
.../main/java/org/apache/iotdb/db/conf/IoTDBDescriptor.java | 6 ++++++
.../iotdb/db/metadata/cache/DataNodeDevicePathCache.java | 8 ++++++--
6 files changed, 45 insertions(+), 3 deletions(-)
diff --git a/docs/UserGuide/Reference/Common-Config-Manual.md b/docs/UserGuide/Reference/Common-Config-Manual.md
index 9b0ad80327..04e42e1757 100644
--- a/docs/UserGuide/Reference/Common-Config-Manual.md
+++ b/docs/UserGuide/Reference/Common-Config-Manual.md
@@ -797,7 +797,16 @@ Different configuration parameters take effect in the following three ways:
|Description| When there exists old version(v2) TsFile, how many thread will be set up to perform upgrade tasks |
| Type | Int32 |
| Default | 1 |
-| Effective | After restarting system | |
+| Effective | After restarting system |
+
+* device\_path\_cache\_size
+
+| Name | device\_path\_cache\_size |
+|:---------:|:--------------------------------------------------------------------------------------------------------------------------|
+|Description| The max size of the device path cache. This cache is for avoiding initialize duplicated device id object in write process |
+| Type | Int32 |
+| Default | 500000 |
+| Effective | After restarting system |
* insert\_multi\_tablet\_enable\_multithreading\_column\_threshold
diff --git a/docs/zh/UserGuide/Reference/Common-Config-Manual.md b/docs/zh/UserGuide/Reference/Common-Config-Manual.md
index c7b7315b24..0ce361e921 100644
--- a/docs/zh/UserGuide/Reference/Common-Config-Manual.md
+++ b/docs/zh/UserGuide/Reference/Common-Config-Manual.md
@@ -847,6 +847,15 @@ IoTDB ConfigNode 和 DataNode 的公共配置参数位于 `conf` 目录下。
| 默认值 | 1 |
| 改后生效方式 | 重启服务生效 |
+* device\_path\_cache\_size
+
+| 名字 | device\_path\_cache\_size |
+| :----------: |:------------------------------------------------------|
+| 描述 | Device Path 缓存的最大数量,这个缓存可以避免写入过程中重复的 Device Path 对象创建 |
+| 类型 | Int32 |
+| 默认值 | 500000 |
+| 改后生效方式 | 重启服务生效 |
+
* insert\_multi\_tablet\_enable\_multithreading\_column\_threshold
| 名字 | insert\_multi\_tablet\_enable\_multithreading\_column\_threshold |
diff --git a/node-commons/src/assembly/resources/conf/iotdb-common.properties b/node-commons/src/assembly/resources/conf/iotdb-common.properties
index 99a7101bb3..e8efbc0771 100644
--- a/node-commons/src/assembly/resources/conf/iotdb-common.properties
+++ b/node-commons/src/assembly/resources/conf/iotdb-common.properties
@@ -538,6 +538,10 @@ cluster_name=defaultCluster
# Datatype: int
# upgrade_thread_count=1
+# The max size of the device path cache. This cache is for avoiding initialize duplicated device id object in write process.
+# Datatype: int
+# device_path_cache_size=500000
+
####################
### Compaction Configurations
####################
diff --git a/server/src/main/java/org/apache/iotdb/db/conf/IoTDBConfig.java b/server/src/main/java/org/apache/iotdb/db/conf/IoTDBConfig.java
index 73af082000..33c1cc3bfa 100644
--- a/server/src/main/java/org/apache/iotdb/db/conf/IoTDBConfig.java
+++ b/server/src/main/java/org/apache/iotdb/db/conf/IoTDBConfig.java
@@ -945,6 +945,8 @@ public class IoTDBConfig {
*/
private int partitionCacheSize = 1000;
+ private int devicePathCacheSize = 500_000;
+
/** Cache size of user and role */
private int authorCacheSize = 100;
@@ -3111,6 +3113,14 @@ public class IoTDBConfig {
this.partitionCacheSize = partitionCacheSize;
}
+ public int getDevicePathCacheSize() {
+ return devicePathCacheSize;
+ }
+
+ public void setDevicePathCacheSize(int devicePathCacheSize) {
+ this.devicePathCacheSize = devicePathCacheSize;
+ }
+
public int getAuthorCacheSize() {
return authorCacheSize;
}
diff --git a/server/src/main/java/org/apache/iotdb/db/conf/IoTDBDescriptor.java b/server/src/main/java/org/apache/iotdb/db/conf/IoTDBDescriptor.java
index c45cfd7ee6..505dce929f 100644
--- a/server/src/main/java/org/apache/iotdb/db/conf/IoTDBDescriptor.java
+++ b/server/src/main/java/org/apache/iotdb/db/conf/IoTDBDescriptor.java
@@ -763,6 +763,12 @@ public class IoTDBDescriptor {
conf.setKerberosPrincipal(
properties.getProperty("kerberos_principal", conf.getKerberosPrincipal()));
+ // the size of device path cache
+ conf.setDevicePathCacheSize(
+ Integer.parseInt(
+ properties.getProperty(
+ "device_path_cache_size", String.valueOf(conf.getDevicePathCacheSize()))));
+
// the num of memtables in each database
conf.setConcurrentWritingTimePartition(
Integer.parseInt(
diff --git a/server/src/main/java/org/apache/iotdb/db/metadata/cache/DataNodeDevicePathCache.java b/server/src/main/java/org/apache/iotdb/db/metadata/cache/DataNodeDevicePathCache.java
index 868d99bf20..0695bab048 100644
--- a/server/src/main/java/org/apache/iotdb/db/metadata/cache/DataNodeDevicePathCache.java
+++ b/server/src/main/java/org/apache/iotdb/db/metadata/cache/DataNodeDevicePathCache.java
@@ -21,17 +21,21 @@ package org.apache.iotdb.db.metadata.cache;
import org.apache.iotdb.commons.exception.IllegalPathException;
import org.apache.iotdb.commons.path.PartialPath;
+import org.apache.iotdb.db.conf.IoTDBConfig;
+import org.apache.iotdb.db.conf.IoTDBDescriptor;
import com.github.benmanes.caffeine.cache.Cache;
import com.github.benmanes.caffeine.cache.Caffeine;
-/** This class is for reducing duplicated Device PartialPath splits in write process. */
+/** This cache is for reducing duplicated DeviceId PartialPath initialization in write process. */
public class DataNodeDevicePathCache {
+ private static final IoTDBConfig config = IoTDBDescriptor.getInstance().getConfig();
+
private final Cache<String, PartialPath> devicePathCache;
private DataNodeDevicePathCache() {
- devicePathCache = Caffeine.newBuilder().maximumSize(1_000_000).build();
+ devicePathCache = Caffeine.newBuilder().maximumSize(config.getDevicePathCacheSize()).build();
}
public static DataNodeDevicePathCache getInstance() {