You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by qi...@apache.org on 2020/07/14 04:51:31 UTC

[incubator-iotdb] branch master updated: Add Tracing Doc (#1485)

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

qiaojialin pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-iotdb.git


The following commit(s) were added to refs/heads/master by this push:
     new a0ed2d1  Add Tracing Doc (#1485)
a0ed2d1 is described below

commit a0ed2d130e26f856a552d19769fedc825e593e86
Author: Xiangwei Wei <34...@users.noreply.github.com>
AuthorDate: Tue Jul 14 12:51:23 2020 +0800

    Add Tracing Doc (#1485)
    
    * Add tracing doc
---
 docs/UserGuide/Operation Manual/SQL Reference.md   | 14 ++++-
 .../System Tools/Performance Tracing Tool.md       | 61 ++++++++++++++++++++++
 .../zh/UserGuide/Operation Manual/SQL Reference.md | 18 +++++--
 .../System Tools/Performance Tracing Tool.md       | 61 ++++++++++++++++++++++
 site/src/main/.vuepress/config.js                  |  6 ++-
 5 files changed, 152 insertions(+), 8 deletions(-)

diff --git a/docs/UserGuide/Operation Manual/SQL Reference.md b/docs/UserGuide/Operation Manual/SQL Reference.md
index fe43e99..fb50f84 100644
--- a/docs/UserGuide/Operation Manual/SQL Reference.md	
+++ b/docs/UserGuide/Operation Manual/SQL Reference.md	
@@ -37,11 +37,12 @@ Do not use the following keywords as identifiers. You can open an [issue](https:
 ```
 CREATE, INSERT, UPDATE, DELETE, SELECT, SHOW, GRANT, INTO, SET, WHERE, FROM, TO, BY, DEVICE,
 CONFIGURATION, DESCRIBE, SLIMIT, LIMIT, UNLINK, OFFSET, SOFFSET, FILL, LINEAR, PREVIOUS, PREVIOUSUNTILLAST,
-METADATA, TIMESERIES, TIMESTAMP, PROPERTY, WITH, ROOT, DATATYPE, COMPRESSOR, STORAGE, GROUP, LABEL, ADD, UPSERT, VALUES, NOW, LINK, INDEX, USING, ON, DROP, MERGE, LIST, USER, PRIVILEGES, ROLE, ALL, OF,
+METADATA, TIMESERIES, TIMESTAMP, PROPERTY, WITH, ROOT, DATATYPE, COMPRESSOR, STORAGE, GROUP, LABEL, ADD,
+UPSERT, VALUES, NOW, LINK, INDEX, USING, ON, DROP, MERGE, LIST, USER, PRIVILEGES, ROLE, ALL, OF,
 ALTER, PASSWORD, REVOKE, LOAD, WATERMARK_EMBEDDING, UNSET, TTL, FLUSH, TASK, INFO, DYNAMIC, PARAMETER, VERSION,
 REMOVE, MOVE, CHILD, PATHS, DEVICES, COUNT, NODES, LEVEL, MIN_TIME, MAX_TIME, MIN_VALUE, MAX_VALUE, AVG, FIRST_VALUE,
 SUM, LAST_VALUE, LAST, DISABLE, ALIGN, COMPRESSION, TIME, ATTRIBUTES, TAGS,RENAME, FULL, CLEAR, CACHE,
-SNAPSHOT, FOR, SCHEMA
+SNAPSHOT, FOR, SCHEMA, TRACING, OFF
 ```
 
 ## Show Version
@@ -953,6 +954,15 @@ This example will delete the first 3 time partitions of storage group root.sg1.
 ```
 The partitionId can be found in data folders or converted using `timestamp / partitionInterval`.
 
+## Performance Tracing
+
+IoTDB supports tracking the execution of query statements by using `TRACING` statements. The number of tsfile files and chunks accessed by the query etc are output through the log file. The default output location is in `./data/tracing`. The performance tracing function is turned off by default. Users can use the TRACING ON/OFF command to turn this function on/off.
+
+```
+TRACING ON    // Open performance tracing
+TRACING OFF   // Close performance tracing
+```
+
 # Reference
 
 ## Keywords
diff --git a/docs/UserGuide/System Tools/Performance Tracing Tool.md b/docs/UserGuide/System Tools/Performance Tracing Tool.md
new file mode 100644
index 0000000..2bf4a00
--- /dev/null
+++ b/docs/UserGuide/System Tools/Performance Tracing Tool.md	
@@ -0,0 +1,61 @@
+<!--
+
+    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.
+
+-->
+# Performance Tracing Tool
+
+IoTDB supports the use of `TRACING` statements to enable and disable performance tracing of query statements, which is disabled by default. Users can use performance tracking tool to analyze potential performance problems in some queries. By default, the log files for performance tracing are stored in the directory `./data/tracing`.
+
+Turn on Tracing:
+
+`IoTDB> TRACING ON`
+
+Turn off Tracing:
+
+`IoTDB> TRACING OFF`
+
+Since the cost of an IoTDB query mainly depends on the number of time series queried, the number of tsfile files accessed, the total number of chunks to be scanned and the average size of each chunk (the number of data points contained in the chunk). Therefore, the current performance analysis includes the following contents:
+
+- Start time
+- Query statement
+- Number of series paths
+- Number of tsfiles
+- Number of sequence files
+- Number of unsequence files
+- Number of chunks
+- Average size of chunks
+- End time
+
+## Example
+
+For example, execute `select * from root`, the contents of the tracing log file will include the following contents:
+
+```
+Query Id: 2 - Start time: 2020-06-28 10:53:54.727
+Query Id: 2 - Query Statement: select * from root
+Query Id: 2 - Number of series paths: 3
+Query Id: 2 - Number of tsfiles: 2
+Query Id: 2 - Number of sequence files: 2
+Query Id: 2 - Number of unsequence files: 0
+Query Id: 2 - Number of chunks: 3
+Query Id: 2 - Average size of chunks: 4113
+Query Id: 2 - End time: 2020-06-28 10:54:44.059
+```
+
+In order to avoid disordered output information caused by multiple queries being executed at the same time, the Query ID is added before each output information. Users can use `grep "Query ID: 2" tracing.txt` to extract all tracing information of one query.
diff --git a/docs/zh/UserGuide/Operation Manual/SQL Reference.md b/docs/zh/UserGuide/Operation Manual/SQL Reference.md
index 0d561db..f3a1ad8 100644
--- a/docs/zh/UserGuide/Operation Manual/SQL Reference.md	
+++ b/docs/zh/UserGuide/Operation Manual/SQL Reference.md	
@@ -28,11 +28,12 @@
 ```
 CREATE, INSERT, UPDATE, DELETE, SELECT, SHOW, GRANT, INTO, SET, WHERE, FROM, TO, BY, DEVICE,
 CONFIGURATION, DESCRIBE, SLIMIT, LIMIT, UNLINK, OFFSET, SOFFSET, FILL, LINEAR, PREVIOUS, PREVIOUSUNTILLAST,
-METADATA, TIMESERIES, TIMESTAMP, PROPERTY, WITH, ROOT, DATATYPE, COMPRESSOR, STORAGE, GROUP, LABEL, ADD, UPSERT, VALUES, NOW, LINK, INDEX, USING, ON, DROP, MERGE, LIST, USER, PRIVILEGES, ROLE, ALL, OF,
+METADATA, TIMESERIES, TIMESTAMP, PROPERTY, WITH, ROOT, DATATYPE, COMPRESSOR, STORAGE, GROUP, LABEL, ADD,
+UPSERT, VALUES, NOW, LINK, INDEX, USING, ON, DROP, MERGE, LIST, USER, PRIVILEGES, ROLE, ALL, OF,
 ALTER, PASSWORD, REVOKE, LOAD, WATERMARK_EMBEDDING, UNSET, TTL, FLUSH, TASK, INFO, DYNAMIC, PARAMETER, VERSION,
-REMOVE, MOVE, CHILD, PATHS, DEVICES, COUNT, NODES, LEVEL, MIN_TIME, MAX_TIME, MIN_VALUE, MAX_VALUE, AVG, FIRST_VALU,
-SUM, LAST_VALUE, LAST, DISABLE, ALIGN, COMPRESSION, TIME, ATTRIBUTES, TAGS,RENAME, FULL, CLEAR, CACHE
-SNAPSHOT, FOR, SCHEMA
+REMOVE, MOVE, CHILD, PATHS, DEVICES, COUNT, NODES, LEVEL, MIN_TIME, MAX_TIME, MIN_VALUE, MAX_VALUE, AVG, FIRST_VALUE,
+SUM, LAST_VALUE, LAST, DISABLE, ALIGN, COMPRESSION, TIME, ATTRIBUTES, TAGS,RENAME, FULL, CLEAR, CACHE,
+SNAPSHOT, FOR, SCHEMA, TRACING, OFF
 ```
 
 ## 显示版本号
@@ -914,6 +915,15 @@ Eg DELETE PARTITION root.sg1 0,1,2
 ```
 partitionId 可以通过查看数据文件夹获取,或者是计算 `timestamp / partitionInterval`得到。 
 
+## 性能追踪
+
+IoTDB 支持使用 `TRACING` 语句来追踪查询语句的执行,通过日志文件输出该查询访问的 Tsfile 文件数,chunk 数等信息,默认输出位置位于 `./data/tracing`. 性能追踪功能默认处于关闭状态,用户可以使用 TRACING ON/OFF 命令来打开/关闭该功能。
+
+```
+TRACING ON    //打开性能追踪
+TRACING OFF   //关闭性能追踪
+```
+
 # 参考
 
 ## 关键字
diff --git a/docs/zh/UserGuide/System Tools/Performance Tracing Tool.md b/docs/zh/UserGuide/System Tools/Performance Tracing Tool.md
new file mode 100644
index 0000000..05fb5f6
--- /dev/null
+++ b/docs/zh/UserGuide/System Tools/Performance Tracing Tool.md	
@@ -0,0 +1,61 @@
+<!--
+
+    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 支持使用 `TRACING` 语句来启用/禁用对查询语句的性能追踪,默认处于禁用状态。用户可以使用性能追踪工具来分析某些查询中存在的潜在性能问题。性能分析的日志文件默认存储在 `./data/tracing` 目录下。
+
+启用 Tracing:
+
+`IoTDB> TRACING ON`
+
+禁用 Tracing:
+
+`IoTDB> TRACING OFF`
+
+由于一个 IoTDB 查询时间主要取决于查询的时间序列数、涉及访问的 Tsfile 文件数、需要扫描的 chunk 总数以及平均每个 chunk 的大小(指该 chunk 中包含的数据点的个数)。因此,目前性能分析包括的内容如下:
+
+- Start time
+- Query statement
+- Number of series paths
+- Number of tsfiles
+- Number of sequence files
+- Number of unsequence files
+- Number of chunks
+- Average size of chunks
+- End time
+
+## Example
+
+例如执行 `select * from root`,则 tracing 日志文件的内容会包括以下内容:
+
+```
+Query Id: 2 - Start time: 2020-06-28 10:53:54.727
+Query Id: 2 - Query Statement: select * from root
+Query Id: 2 - Number of series paths: 3
+Query Id: 2 - Number of tsfiles: 2
+Query Id: 2 - Number of sequence files: 2
+Query Id: 2 - Number of unsequence files: 0
+Query Id: 2 - Number of chunks: 3
+Query Id: 2 - Average size of chunks: 4113
+Query Id: 2 - End time: 2020-06-28 10:54:44.059
+```
+
+为了避免多个查询同时执行导致输出信息乱序,在每条输出信息前均增加了该次查询的 Query Id,用户可以使用 `grep "Query Id: 2" tracing.txt` 来提取某次查询的所有追踪信息。
diff --git a/site/src/main/.vuepress/config.js b/site/src/main/.vuepress/config.js
index 56d5f9b..4eb692c 100644
--- a/site/src/main/.vuepress/config.js
+++ b/site/src/main/.vuepress/config.js
@@ -468,7 +468,8 @@ var config = {
 							['System Tools/Log Visualizer','Log Visualizer'],
 							['System Tools/Query History Visualization Tool','Query History Visualization Tool'],
 							['System Tools/Monitor and Log Tools','Monitor and Log Tools'],
-							['System Tools/Load External Tsfile','Load External Tsfile']
+							['System Tools/Load External Tsfile','Load External Tsfile'],
+							['System Tools/Performance Tracing Tool','Performance Tracing Tool']
 						]
 					},
 					{
@@ -990,7 +991,8 @@ var config = {
 							['System Tools/Log Visualizer','日志可视化工具'],
 							['System Tools/Query History Visualization Tool','查询历史可视化工具'],
 							['System Tools/Monitor and Log Tools','监控与日志工具'],
-							['System Tools/Load External Tsfile','加载外部tsfile文件']
+							['System Tools/Load External Tsfile','加载外部tsfile文件'],
+							['System Tools/Performance Tracing Tool','性能追踪工具']
 						]
 					},
 					{