You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by xu...@apache.org on 2021/12/31 08:05:44 UTC

[iotdb] 01/02: init docs

This is an automated email from the ASF dual-hosted git repository.

xuekaifeng pushed a commit to branch xkf_id_table
in repository https://gitbox.apache.org/repos/asf/iotdb.git

commit 1aa0ef88d918f3f8f4c565c5f71382ee615bf596
Author: 151250176 <15...@smail.nju.edu.cn>
AuthorDate: Fri Dec 31 15:10:11 2021 +0800

    init docs
---
 .../StorageEngine/VirtualStorageGroup.md           | 65 ++++++++++++++++++++++
 docs/UserGuide/Appendix/Config-Manual.md           |  9 +++
 .../StorageEngine/VirtualStorageGroup.md           | 62 +++++++++++++++++++++
 docs/zh/UserGuide/Appendix/Config-Manual.md        |  9 +++
 4 files changed, 145 insertions(+)

diff --git a/docs/SystemDesign/StorageEngine/VirtualStorageGroup.md b/docs/SystemDesign/StorageEngine/VirtualStorageGroup.md
new file mode 100644
index 0000000..7029eb1
--- /dev/null
+++ b/docs/SystemDesign/StorageEngine/VirtualStorageGroup.md
@@ -0,0 +1,65 @@
+<!--
+
+    Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements.  See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership.  The ASF licenses this file
+    to you under the Apache License, Version 2.0 (the
+    "License"); you may not use this file except in compliance
+    with the License.  You may obtain a copy of the License at
+    
+        http://www.apache.org/licenses/LICENSE-2.0
+    
+    Unless required by applicable law or agreed to in writing,
+    software distributed under the License is distributed on an
+    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+    KIND, either express or implied.  See the License for the
+    specific language governing permissions and limitations
+    under the License.
+
+-->
+
+# Background
+
+The storage group is specified by the user display.
+Use the statement "SET STORAGE GROUP TO" to specify the storage group.
+Each storage group has a corresponding StorageGroupProcessor.
+
+To ensure eventually consistency, a insert lock (exclusive lock) is used to synchronize each insert request in each storage group.
+So the server side parallelism of data ingestion is equal to the number of storage group.
+
+# Problem
+
+From background, we can infer that the parallelism of data ingestion of IoTDB is max(num of client, server side parallelism), which equals to max(num of client, num of storage group)
+
+The concept of storage group usually is related to real world entity such as factory, location, country and so on.
+The number of storage groups may be small which makes the parallelism of data ingestion of IoTDB insufficient. We can't jump out of this dilemma even we start hundreds of client for ingestion.
+
+ 
+# Analyze
+
+In IoTDB, every kinds of ingestion interface can only insert timeseries of on device.
+One idea by intuition is changing the granularity of synchronization from storage group level to device level.
+However, one lock for one device may occupy lots of resource that beyond our expectation. One lock means about 100 bytes of memory and one kernel object.
+Sometimes the number of devices may reach one million and we can't afford such lock resource.
+
+As the analysis progresses, we think we should trade off between granularity of synchronization and resource occupation.
+
+# Solution
+
+Our idea is to group devices into buckets and chang the granularity of synchronization from storage group level to device buckets level.
+
+In detail, we use hash to group different devices into buckets called virtual storage group. 
+For example, one device called "root.sg.d" is belonged to virtual storage group NO (hash("root.sg.d") mod num_of_virtual_storage_group)
+
+# Usage
+
+To use virtual storage group, you can set this config below:
+
+```
+virtual_storage_group_num
+```
+
+Recommended value is [virtual storage group number] = [CPU core number] / [user-defined storage group number]
+
+For more information, you can refer to [this page](../../UserGuide/Appendix/Config-Manual.md).
\ No newline at end of file
diff --git a/docs/UserGuide/Appendix/Config-Manual.md b/docs/UserGuide/Appendix/Config-Manual.md
index e0f119d..b3aa37f 100644
--- a/docs/UserGuide/Appendix/Config-Manual.md
+++ b/docs/UserGuide/Appendix/Config-Manual.md
@@ -739,6 +739,15 @@ The permission definitions are in ${IOTDB\_CONF}/conf/jmx.access.
 |Default| 604800 |
 |Effective|Only allowed to be modified in first start up|
 
+* virtual\_storage\_group\_num
+
+|Name| virtual\_storage\_group\_num |
+|:---:|:---|
+|Description| number of virtual storage groups per user-defined storage group, a virtual storage group is the unit of parallelism in memory as all ingestions in one virtual storage group are serialized, recommended value is [virtual storage group number] = [CPU core number] / [user-defined storage group number]|
+|Type| LONG |
+|Default| 1 |
+|Effective|Only allowed to be modified in first start up|
+
 * enable\_id\_table
 
 |Name| enable\_id\_table |
diff --git a/docs/zh/SystemDesign/StorageEngine/VirtualStorageGroup.md b/docs/zh/SystemDesign/StorageEngine/VirtualStorageGroup.md
new file mode 100644
index 0000000..6521e7a
--- /dev/null
+++ b/docs/zh/SystemDesign/StorageEngine/VirtualStorageGroup.md
@@ -0,0 +1,62 @@
+<!--
+
+    Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements.  See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership.  The ASF licenses this file
+    to you under the Apache License, Version 2.0 (the
+    "License"); you may not use this file except in compliance
+    with the License.  You may obtain a copy of the License at
+    
+        http://www.apache.org/licenses/LICENSE-2.0
+    
+    Unless required by applicable law or agreed to in writing,
+    software distributed under the License is distributed on an
+    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+    KIND, either express or implied.  See the License for the
+    specific language governing permissions and limitations
+    under the License.
+
+-->
+
+# 背景
+
+存储组由用户显示指定,使用语句"SET STORAGE GROUP TO"来指定存储组,每一个存储组有一个对应的 StorageGroupProcessor
+
+为了确保最终一致性,每一个存储组有一个数据插入锁(排它锁)来同步每一次插入操作。
+所以服务端数据写入的并行度为存储组的数量。
+
+# 问题
+
+从背景中可知,IoTDB数据写入的并行度为 max(客户端数量,服务端数据写入的并行度),也就是max(客户端数量,存储组数量)
+
+在生产实践中,存储组的概念往往与特定真实世界实体相关(例如工厂,地点,国家等)。
+因此存储组的数量可能会比较小,这会导致IoTDB写入并行度不足。即使我们开再多的客户端写入线程,也无法走出这种困境。
+
+# Analyze
+
+In IoTDB, every kinds of ingestion interface can only insert timeseries of on device.
+One idea by intuition is changing the granularity of synchronization from storage group level to device level.
+However, one lock for one device may occupy lots of resource that beyond our expectation. One lock means about 100 bytes of memory and one kernel object.
+Sometimes the number of devices may reach one million and we can't afford such lock resource.
+
+As the analysis progresses, we think we should trade off between granularity of synchronization and resource occupation.
+
+# Solution
+
+Our idea is to group devices into buckets and chang the granularity of synchronization from storage group level to device buckets level.
+
+In detail, we use hash to group different devices into buckets called virtual storage group. 
+For example, one device called "root.sg.d" is belonged to virtual storage group NO (hash("root.sg.d") mod num_of_virtual_storage_group)
+
+# Usage
+
+To use virtual storage group, you can set this config below:
+
+```
+virtual_storage_group_num
+```
+
+Recommended value is [virtual storage group number] = [CPU core number] / [user-defined storage group number]
+
+For more information, you can refer to [this page](../../UserGuide/Appendix/Config-Manual.md).
\ No newline at end of file
diff --git a/docs/zh/UserGuide/Appendix/Config-Manual.md b/docs/zh/UserGuide/Appendix/Config-Manual.md
index 78786f9..d0a0273 100644
--- a/docs/zh/UserGuide/Appendix/Config-Manual.md
+++ b/docs/zh/UserGuide/Appendix/Config-Manual.md
@@ -1485,6 +1485,15 @@
 |默认值| 604800 |
 |改后生效方式|仅允许在第一次启动服务前修改|
 
+* virtual\_storage\_group\_num
+
+|名字| virtual\_storage\_group\_num |
+|:---:|:---|
+|描述| 每一个用户定义存储组下虚拟存储组的数量, 虚拟存储组是内存中写入的并行单位,每一个虚拟存储组内的写入请求是串行的,推荐值为: [virtual storage group number] = [CPU core number] / [user-defined storage group number]|
+|类型| INT32 |
+|默认值| 1 |
+|改后生效方式|仅允许在第一次启动服务前修改|
+
 * enable\_id\_table
 
 |名字| enable\_id\_table |