You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by xi...@apache.org on 2022/12/02 13:41:50 UTC

[iotdb] branch rel/1.0 updated: [To rel/1.0] Add Deploy recommendation in docs (#8306)

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

xingtanzjr pushed a commit to branch rel/1.0
in repository https://gitbox.apache.org/repos/asf/iotdb.git


The following commit(s) were added to refs/heads/rel/1.0 by this push:
     new ca7f58e16e [To rel/1.0] Add Deploy recommendation in docs (#8306)
ca7f58e16e is described below

commit ca7f58e16eeb165638930dcbe24807c737c3a16f
Author: Haonan <hh...@outlook.com>
AuthorDate: Fri Dec 2 21:41:44 2022 +0800

    [To rel/1.0] Add Deploy recommendation in docs (#8306)
    
    * Add Deploy recommendation doc
    
    * update star
    
    * update format
    
    * update format
    
    * update config.js
    
    * update Quickstart
    
    * update eng doc
---
 .../UserGuide/Cluster/Deployment-Recommendation.md | 178 +++++++++++++++++++++
 docs/UserGuide/QuickStart/QuickStart.md            |   2 +-
 .../UserGuide/Cluster/Deployment-Recommendation.md | 176 ++++++++++++++++++++
 site/src/main/.vuepress/config.js                  |  12 +-
 4 files changed, 363 insertions(+), 5 deletions(-)

diff --git a/docs/UserGuide/Cluster/Deployment-Recommendation.md b/docs/UserGuide/Cluster/Deployment-Recommendation.md
new file mode 100644
index 0000000000..9c9b53d95c
--- /dev/null
+++ b/docs/UserGuide/Cluster/Deployment-Recommendation.md
@@ -0,0 +1,178 @@
+<!--
+
+    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.
+
+-->
+
+# IoTDB Deployment Recommendation
+## Backgrands
+
+System Abilities
+- Performance: write and read performance, compression ratio
+- Extensibility: system has ability to manage data with multiple nodes, essentially data can be manage by partitions
+- High availability(HA): system has ability to tolerate node disconnected, essentially whether the data has replicas
+- Consistency:when data with multiple copies, whether the replicas consistent, essentially treat the database as a single node
+
+Abbreviation
+- C: ConfigNode
+- D: DataNode
+- aCbD:cluster with a ConfigNodes and b DataNodes
+
+## Deployment mode
+
+|                  mode                   | Performance    | Extensibility | HA     | Consistency |
+|:---------------------------------------:|:---------------|:--------------|:-------|:------------|
+|       Lightweight standalone mode       | Extremely High | None          | None   | High        |
+|        Scalable standalone mode         | High           | High          | Medium | High        |
+| High performance cluster mode (default) | High           | High          | High   | Medium      |
+|     Strong consistency cluster mode     | Medium         | High          | High   | High        | 
+
+
+|                 Config                 | Lightweight standalone mode | Scalable single node mode | High performance mode | trong consistency cluster mode |
+|:--------------------------------------:|:----------------------------|:--------------------------|:----------------------|:-------------------------------|
+|           ConfigNode number            | 1                           | ≥1 (odd number)           | ≥1 (odd number)       | ≥1 (odd number)                |
+|            DataNode number             | 1                           | ≥1                        | ≥3                    | ≥3                             |
+|       schema_replication_factor        | 1                           | 1                         | 3                     | 3                              |
+|        data_replication_factor         | 1                           | 1                         | 2                     | 3                              |
+|  config_node_consensus_protocol_class  | Simple                      | Ratis                     | Ratis                 | Ratis                          |
+| schema_region_consensus_protocol_class | Simple                      | Ratis                     | Ratis                 | Ratis                          |
+|  data_region_consensus_protocol_class  | Simple                      | IoT                       | IoT                   | Ratis                          |
+
+
+## Deployment Recommendation
+
+### Upgrade from v0.13 to v1.0
+
+Scenario:
+Already has some data under v0.13, hope to upgrade to v1.0.
+
+Options:
+1. Upgrade to 1C1D standalone mode, allocate 2GB memory to ConfigNode, allocate same memory size with v0.13 to DataNode.
+2. Upgrade to 3C3D cluster mode, allocate 2GB memory to ConfigNode, allocate same memory size with v0.13 to DataNode.
+
+Configuration modification:
+
+- Do not point v1.0 data directory to v0.13 data directory
+- region_group_extension_strategy=COSTOM
+- data_region_group_per_database
+    - for 3C3D cluster mode: Cluster CPU total core num / data_replication_factor
+    - for 1C1D standalone mode: use virtual_storage_group_num in v0.13
+
+Data migration:
+After modified the configuration, use load-tsfile tool to load the TsFiles of v0.13 to v1.0.
+
+### Use v1.0 directly
+
+**Recommend to use 1 Database only**
+
+#### Memory estimation
+
+##### Use active series number to estimate memory size
+
+Cluster DataNode total heap size(GB) = active series number / 100000 * data_replication_factor
+
+Heap size of each DataNode (GB) = Cluster DataNode total heap size / DataNode number
+
+> Example: use 3C3D to manage 1 million timeseries, use 3 data replicas
+> - Cluster DataNode total heap size: 1,000,000 / 100,000 * 3 = 30G
+> - 每Heap size of each DataNode: 30 / 3 = 10G
+
+##### Use total series number to estimate memory size
+
+Cluster DataNode total heap size(B) = 20 * (180 + 2 * average character num of the series full path) * total series number * schema_replication_factor
+
+Heap size of each DataNode = Cluster DataNode total heap size / DataNode number
+
+> Example: use 3C3D to manage 1 million timeseries, use 3schema replicas, series name such as root.sg_1.d_10.s_100(20 chars)
+> - Cluster DataNode total heap size: 20 * (180 + 2 * 20)* 1,000,000 * 3 = 13.2 GB
+> - Heap size of each DataNode: 13.2 GB / 3 = 4.4 GB
+
+#### Disk estimation
+
+IoTDB storage size = data storage size + schema storage size + temp storage size
+
+##### Data storage size
+
+Series number * Sampling frequency * Data point size * Storage duration * data_replication_factor /  10 (compression ratio)
+
+| Data Type \ Data point size | Timestamp (Byte) | Value (Byte) | Total (Byte) |
+|:---------------------------:|:-----------------|:-------------|:-------------|
+|           Boolean           | 8                | 1            | 9            |
+|        INT32 / FLOAT        | 8                | 4            | 12           |
+|       INT64)/ DOUBLE        | 8                | 8            | 16           |
+|            TEXT             | 8                | Assuming a   | 8+a          | 
+
+
+> Example: 1000 devices, 100 sensors for one device, 100,000 series total, INT32 data type, 1Hz sampling frequency, 1 year storage duration, 3 replicas, compression ratio is 10
+> Data storage size = 1000 * 100 * 12 * 86400 * 365 * 3 / 10 = 11T
+
+##### Schema storage size
+
+One series uses the path charactor byte size + 20 bytes.
+If the series has tag, add the tag charactor byte size.
+
+##### Temp storage size
+
+Temp storage size = WAL storage size  + Consensus storage size + Compaction temp storage size
+
+1. WAL
+
+max wal storage size = memtable memory size ÷ wal_min_effective_info_ratio
+- memtable memory size is decided by storage_query_schema_consensus_free_memory_proportion, storage_engine_memory_proportion and write_memory_proportion
+- wal_min_effective_info_ratio is decided by wal_min_effective_info_ratio configuration
+
+> Example: allocate 16G memory for Datanode, config as below:
+>  storage_query_schema_consensus_free_memory_proportion=3:3:1:1:2
+>  storage_engine_memory_proportion=8:2
+>  write_memory_proportion=19:1
+>  wal_min_effective_info_ratio=0.1
+>  max wal storage size = 16 * (3 / 10) * (8 / 10) * (19 / 20)  ÷ 0.1 = 36.48G
+
+2. Consensus
+
+Ratis consensus
+When using ratis consensus protocol, we need extra storage for Raft Log. Raft Log will be deleted after state machine takes snapshot.
+We can adjust `trigger_snapshot_threshold` to control the maximum Raft Log disk usage.
+
+
+Raft Log disk size in each Region = average * trigger_snapshot_threshold
+
+The total Raft Log storage space is proportional to the data replica number
+
+> Example: DataRegion, 20kB data for one request, data_region_trigger_snapshot_threshold = 400,000, then max Raft Log disk size = 20K * 400,000 = 8G.
+Raft Log increases from 0 to 8GB, and then turns to 0 after snapshot. Average size will be 4GB.
+When replica number is 3, max Raft log size will be 3 * 8G = 24G.
+
+3. Compaction
+
+- Inner space compaction
+  Disk space for temporary files = Total Disk space of origin files
+
+  > Example: 10 origin files, 100MB for each file
+  > Disk space for temporary files = 10 * 100 = 1000M
+
+
+- Outer space compaction
+  The overlap of out-of-order data = overlapped data amount  / total out-of-order data amount
+
+  Disk space for temporary file = Total ordered Disk space of origin files + Total out-of-order disk space of origin files *(1 - overlap)
+  > Example: 10 sequence files, 10 out-of-order files, 100M for each sequence file, 50M for each out-of-order file, half of data is overlapped with sequence file
+  > The overlap of out-of-order data = 25M/50M * 100% = 50%
+  > Disk space for temporary files = 10 * 100 + 10 * 50 * 50% = 1250M
+
+
diff --git a/docs/UserGuide/QuickStart/QuickStart.md b/docs/UserGuide/QuickStart/QuickStart.md
index ad32b6ec62..56cd9349a2 100644
--- a/docs/UserGuide/QuickStart/QuickStart.md
+++ b/docs/UserGuide/QuickStart/QuickStart.md
@@ -35,7 +35,7 @@ To use IoTDB, you need to have:
 IoTDB provides you three installation methods, you can refer to the following suggestions, choose one of them:
 
 * Installation from source code. If you need to modify the code yourself, you can use this method.
-* Installation from binary files. Download the binary files from the official website. This is the recommended method, in which you will get a binary released package which is out-of-the-box.(Coming Soon...)
+* Installation from binary files. Download the binary files from the official website. This is the recommended method, in which you will get a binary released package which is out-of-the-box.
 * Using Docker:The path to the dockerfile is https://github.com/apache/iotdb/blob/master/docker/src/main
 
 
diff --git a/docs/zh/UserGuide/Cluster/Deployment-Recommendation.md b/docs/zh/UserGuide/Cluster/Deployment-Recommendation.md
new file mode 100644
index 0000000000..0838928f9f
--- /dev/null
+++ b/docs/zh/UserGuide/Cluster/Deployment-Recommendation.md
@@ -0,0 +1,176 @@
+<!--
+
+    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.
+
+-->
+
+# IoTDB 部署推荐
+## 背景
+
+系统能力
+- 性能需求:系统读写速度,压缩比
+- 扩展性:系统能够用多节点管理数据,本质上是数据是否可分区管理
+- 高可用:系统能够容忍节点失效,本质上是数据是否有副本
+- 一致性:当数据有多副本时,不同副本是否一致,本质上用户是否能将数据库当做单机看待
+
+缩写
+- C:ConfigNode
+- D:DataNode
+- aCbD:a 个 ConfigNode 和 b 个 DataNode
+
+## 部署模式选型
+
+|      模式      | 性能  | 扩展性 | 高可用 | 一致性 |
+|:------------:|:----|:----|:----|:----|
+|    轻量单机模式    | 最高  | 无   | 无   | 高   |
+|   可扩展单节点模式   | 高   | 高   | 中   | 高   |
+| 高性能分布式模式(默认) | 高   | 高   | 高   | 中   |
+|   强一致分布式模式   | 中   | 高   | 高   | 高   |
+
+
+|                           配置                           | 轻量单机模式 | 可扩展单节点模式 | 高性能分布式模式 | 强一致分布式模式 |
+|:------------------------------------------------------:|:-------|:---------|:---------|:---------|
+|                     ConfigNode 个数                      | 1      | ≥1 (奇数)  | ≥1 (奇数)  | ≥1(奇数)   |
+|                      DataNode 个数                       | 1      | ≥1       | ≥3       | ≥3       |
+|            元数据副本 schema_replication_factor             | 1      | 1        | 3        | 3        |
+|              数据副本 data_replication_factor              | 1      | 1        | 2        | 3        |
+|   ConfigNode 协议 config_node_consensus_protocol_class   | Simple | Ratis    | Ratis    | Ratis    |
+| SchemaRegion 协议 schema_region_consensus_protocol_class | Simple | Ratis    | Ratis    | Ratis    |
+|   DataRegion 协议 data_region_consensus_protocol_class   | Simple | IoT      | IoT      | Ratis    |
+
+
+## 部署配置推荐
+
+### 从 0.13 版本升级到 1.0
+
+场景:
+已在 0.13 版本存储了部分数据,希望迁移到 1.0 版本,并且与 0.13 表现保持一致。
+
+可选方案:
+1. 升级到 1C1D 单机版,ConfigNode 分配 2G 内存,DataNode 与 0.13 一致。
+2. 升级到 3C3D 高性能分布式,ConfigNode 分配 2G 内存,DataNode 与 0.13 一致。
+
+配置修改:
+1.0 配置参数修改:
+- 数据目录不要指向0.13原有数据目录
+- region_group_extension_strategy=COSTOM
+- data_region_group_per_database
+    - 如果是 3C3D 高性能分布式:则改为:集群 CPU 总核数/ 数据副本数
+    - 如果是 1C1D,则改为:等于 0.13 的 virtual_storage_group_num 即可 ("database"一词 与 0.13 中的 "sg" 同义)
+
+数据迁移:
+配置修改完成后,通过 load-tsfile 工具将 0.13 的 TsFile 都加载进 1.0 的 IoTDB 中,即可使用。
+
+### 直接使用 1.0
+
+**推荐用户仅设置 1 个 Database**
+
+#### 内存设置方法
+##### 根据活跃序列数估计内存
+
+集群 DataNode 总堆内内存(GB) = 活跃序列数/100000 * 数据副本数
+
+每个 DataNode 堆内内存(GB)= 集群DataNode总堆内内存 / DataNode 个数
+
+> 假设需要用3C3D管理100万条序列,数据采用3副本,则:
+> - 集群 DataNode 总堆内内存(GB):1,000,000 / 100,000 * 3 = 30G
+> - 每台 DataNode 的堆内内存配置为:30 / 3 = 10G
+
+##### 根据总序列数估计内存
+  
+集群 DataNode 总堆内内存 (B) = 20 * (180 + 2 * 序列的全路径的平均字符数)* 序列总量 * 元数据副本数
+
+每个 DataNode 内存配置推荐:集群 DataNode 总堆内内存 / DataNode 数目
+
+> 假设需要用3C3D管理100万条序列,元数据采用3副本,序列名形如 root.sg_1.d_10.s_100(约20字符),则:
+> - 集群 DataNode 总堆内内存:20 * (180 + 2 * 20)* 1,000,000 * 3 = 13.2 GB
+> - 每台 DataNode 的堆内内存配置为:13.2 GB / 3 = 4.4 GB
+
+#### 磁盘估计
+
+IoTDB 存储空间=数据存储空间 + 元数据存储空间 + 临时存储空间
+
+##### 数据磁盘空间
+
+序列数量 * 采样频率 * 每个数据点大小 * 存储时长 * 副本数 /  10 倍压缩比
+
+|       数据类型 \ 数据点大小        | 时间戳(字节) | 值(字节) | 总共(字节) |
+|:-------------------------:|:--------|:------|:-------|
+|       开关量(Boolean)        | 8       | 1     | 9      |
+|  整型(INT32)/单精度浮点数(FLOAT)  | 8       | 4     | 12     |
+| 长整型(INT64)/双精度浮点数(DOUBLE) | 8       | 8     | 16     |
+|         字符串(TEXT)         | 8       | 假设为 a | 8+a    | 
+
+
+> 示例:1000设备,每个设备100 测点,共 100000 序列。整型。采样频率1Hz(每秒一次),存储1年,3副本,压缩比按 10 算,则数据存储空间占用: 
+>  * 简版:1000 * 100 * 12 * 86400 * 365 * 3 / 10 = 11T 
+>  * 完整版:1000设备 * 100测点 * 12字节每数据点 * 86400秒每天 * 365天每年 * 3副本 / 10压缩比 = 11T
+
+##### 元数据磁盘空间
+
+每条序列在磁盘日志文件中大约占用 序列字符数 + 20 字节。
+若序列有tag描述信息,则仍需加上约 tag 总字符数字节的空间。
+
+##### 临时磁盘空间
+
+临时磁盘空间 = 写前日志 + 共识协议 + 合并临时空间
+
+1. 写前日志
+
+最大写前日志空间占用 = memtable 总内存占用 ÷ 最小有效信息占比
+- memtable 总内存占用和 storage_query_schema_consensus_free_memory_proportion、storage_engine_memory_proportion、write_memory_proportion 三个参数有关
+- 最小有效信息占比由 wal_min_effective_info_ratio 决定
+  
+> 示例:为 IoTDB 分配 16G 内存,配置文件如下
+>  storage_query_schema_consensus_free_memory_proportion=3:3:1:1:2
+>  storage_engine_memory_proportion=8:2
+>  write_memory_proportion=19:1
+>  wal_min_effective_info_ratio=0.1
+>  最大写前日志空间占用 = 16 * (3 / 10) * (8 / 10) * (19 / 20)  ÷ 0.1 = 36.48G
+
+2. 共识协议
+
+Ratis共识协议
+采用Ratis共识协议的情况下,需要额外磁盘空间存储Raft Log。Raft Log会在每一次状态机 Snapshot 之后删除,因此可以通过调整 trigger_snapshot_threshold 参数控制Raft Log最大空间占用。
+
+每一个 Region Raft Log占用最大空间 = 平均请求大小 * trigger_snapshot_threshold。
+集群中一个Region总的Raft Log占用空间和Raft数据副本数成正比。
+
+> 示例:DataRegion, 平均每一次插入20k数据,data_region_trigger_snapshot_threshold = 400,000,那么Raft Log最大占用 = 20K * 400,000 = 8G。
+Raft Log会从0增长到8G,接着在snapshot之后重新变成0。平均占用为4G。
+当副本数为3时,集群中这个DataRegion总Raft Log最大占用 3 * 8G = 24G。
+
+3. 合并临时空间
+
+ - 空间内合并
+   临时文件的磁盘空间 = 源文件大小总和
+   
+   > 示例:10个源文件,每个文件大小为100M
+   > 临时文件的磁盘空间 = 10 * 100 = 1000M
+
+
+ - 跨空间合并
+   跨空间合并的临时文件大小与源文件大小和顺乱序数据的重叠度有关,当乱序数据与顺序数据有相同的时间戳时,就认为有重叠。
+   乱序数据的重叠度 = 重叠的乱序数据量 / 总的乱序数据量
+
+   临时文件的磁盘空间 = 源顺序文件总大小 + 源乱序文件总大小 *(1 - 重叠度)
+   > 示例:10个顺序文件,10个乱序文件,每个顺序文件100M,每个乱序文件50M,每个乱序文件里有一半的数据与顺序文件有相同的时间戳 
+   > 乱序数据的重叠度 = 25M/50M * 100% = 50% 
+   > 临时文件的磁盘空间 = 10 * 100 + 10 * 50 * 50% = 1250M
+
+
diff --git a/site/src/main/.vuepress/config.js b/site/src/main/.vuepress/config.js
index e029bfe4f6..e431a919b2 100644
--- a/site/src/main/.vuepress/config.js
+++ b/site/src/main/.vuepress/config.js
@@ -1034,7 +1034,8 @@ var config = {
 						children: [
 							['Cluster/Cluster-Concept','Cluster Concept'],
 							['Cluster/Cluster-Setup','Cluster Setup'],
-							['Cluster/Cluster-Maintenance','Cluster Maintenance']
+							['Cluster/Cluster-Maintenance','Cluster Maintenance'],
+							['Cluster/Deployment-Recommendation','Deployment Recommendation'],
 						]
 					},
 					{
@@ -1267,7 +1268,8 @@ var config = {
 						children: [
 							['Cluster/Cluster-Concept','Cluster Concept'],
 							['Cluster/Cluster-Setup','Cluster Setup'],
-							['Cluster/Cluster-Maintenance','Cluster Maintenance']
+							['Cluster/Cluster-Maintenance','Cluster Maintenance'],
+							['Cluster/Deployment-Recommendation','Deployment Recommendation'],
 						]
 					},
 					{
@@ -2242,7 +2244,8 @@ var config = {
 						children: [
 							['Cluster/Cluster-Concept','基本概念'],
 							['Cluster/Cluster-Setup','分布式部署'],
-							['Cluster/Cluster-Maintenance','分布式运维命令']
+							['Cluster/Cluster-Maintenance','分布式运维命令'],
+							['Cluster/Deployment-Recommendation','部署推荐'],
 						]
 					},
 					{
@@ -2475,7 +2478,8 @@ var config = {
 						children: [
 							['Cluster/Cluster-Concept','基本概念'],
 							['Cluster/Cluster-Setup','分布式部署'],
-							['Cluster/Cluster-Maintenance','分布式运维命令']
+							['Cluster/Cluster-Maintenance','分布式运维命令'],
+							['Cluster/Deployment-Recommendation','部署推荐'],
 						]
 					},
 					{