You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by ka...@apache.org on 2021/07/08 00:42:52 UTC

[iotdb] branch py_cli_performance created (now 7e6ec75)

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

kangrong pushed a change to branch py_cli_performance
in repository https://gitbox.apache.org/repos/asf/iotdb.git.


      at 7e6ec75  temp

This branch includes the following new commits:

     new 7e6ec75  temp

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


[iotdb] 01/01: temp

Posted by ka...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 7e6ec75d673178454930327da0b4023640e5e781
Author: kr11 <3095717866.com>
AuthorDate: Thu Jul 8 08:42:09 2021 +0800

    temp
---
 client-py/TabletOptimizeAssert.py                  |  85 ++++++++++++++
 client-py/TabletOriginalAssert.py                  |  85 ++++++++++++++
 client-py/iotdb/Session.py                         |  10 +-
 client-py/iotdb/utils/IoTDBConstants.py            |   3 +
 client-py/iotdb/utils/Tablet.py                    | 110 ++++++++++--------
 client-py/tablet_performance_comparison.py         | 127 +++++++++++++++++++++
 client-py/zzz_SessionInsertRecord.py               | 123 ++++++++++++++++++++
 client-py/zzz_TestIOTDb.py                         | 104 +++++++++++++++++
 client-py/zzz_debugInsertRecord.py                 |  28 +++++
 client-py/zzz_main.py                              |  22 ++++
 .../main/java/org/apache/iotdb/TestSession.java    | 100 ++++++++++++++++
 11 files changed, 747 insertions(+), 50 deletions(-)

diff --git a/client-py/TabletOptimizeAssert.py b/client-py/TabletOptimizeAssert.py
new file mode 100644
index 0000000..98bb02f
--- /dev/null
+++ b/client-py/TabletOptimizeAssert.py
@@ -0,0 +1,85 @@
+# 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.
+#
+
+# Uncomment the following line to use apache-iotdb module installed by pip3
+
+from iotdb.Session import Session
+from iotdb.utils.IoTDBConstants import TSDataType, TSEncoding, Compressor, UseNew
+from iotdb.utils.Tablet import Tablet
+import random
+import numpy as np
+from numba import jit
+
+# creating session connection.
+ip = "127.0.0.1"
+port_ = "6667"
+username_ = "root"
+password_ = "root"
+session = Session(ip, port_, username_, password_, fetch_size=1024, zone_id="UTC+8")
+session.open(False)
+import time
+
+# parameters for test
+row_size = 10000
+column_size = 2000
+
+
+measurements_ = ["s_01", "s_02", "s_03", "s_04", "s_05", "s_06"]
+data_types_ = [
+    TSDataType.BOOLEAN,
+    TSDataType.INT32,
+    TSDataType.INT64,
+    TSDataType.FLOAT,
+    TSDataType.DOUBLE,
+    TSDataType.TEXT,
+]
+one_value = [False, 10, 11, 1.1, 10011.1, "test_record"]
+
+insert_cost = 0
+st = time.perf_counter()
+for i in range(0, column_size):
+    device_id = "root.sg%d.%d" % (i % 8, i)
+    timestamps_ = []
+    values_ = []
+    for t in range(0, row_size):
+        timestamps_.append(t)
+        # values_.append([-2 + 6 * random.random(), True])
+        values_.append(one_value)
+
+    tablet_ = Tablet(device_id, measurements_, data_types_, values_, timestamps_)
+    cost_st = time.perf_counter()
+    session.insert_tablet(tablet_)
+    insert_cost += time.perf_counter() - cost_st
+
+end = time.perf_counter()
+print("use time: %.3f" % (end - st))
+print("insert time: %.3f" % insert_cost)
+print("All executions done!!")
+# assert
+for i in range(0, column_size):
+    device_id = "root.sg%d.%d" % (i % 8, i)
+
+    session_data_set = session.execute_query_statement("select * from " + device_id)
+    session_data_set.set_fetch_size(row_size)
+    while session_data_set.has_next():
+        print(session_data_set.next())
+    session_data_set.close_operation_handle()
+
+session.close()
+
+print("Assert successfully")
diff --git a/client-py/TabletOriginalAssert.py b/client-py/TabletOriginalAssert.py
new file mode 100644
index 0000000..98bb02f
--- /dev/null
+++ b/client-py/TabletOriginalAssert.py
@@ -0,0 +1,85 @@
+# 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.
+#
+
+# Uncomment the following line to use apache-iotdb module installed by pip3
+
+from iotdb.Session import Session
+from iotdb.utils.IoTDBConstants import TSDataType, TSEncoding, Compressor, UseNew
+from iotdb.utils.Tablet import Tablet
+import random
+import numpy as np
+from numba import jit
+
+# creating session connection.
+ip = "127.0.0.1"
+port_ = "6667"
+username_ = "root"
+password_ = "root"
+session = Session(ip, port_, username_, password_, fetch_size=1024, zone_id="UTC+8")
+session.open(False)
+import time
+
+# parameters for test
+row_size = 10000
+column_size = 2000
+
+
+measurements_ = ["s_01", "s_02", "s_03", "s_04", "s_05", "s_06"]
+data_types_ = [
+    TSDataType.BOOLEAN,
+    TSDataType.INT32,
+    TSDataType.INT64,
+    TSDataType.FLOAT,
+    TSDataType.DOUBLE,
+    TSDataType.TEXT,
+]
+one_value = [False, 10, 11, 1.1, 10011.1, "test_record"]
+
+insert_cost = 0
+st = time.perf_counter()
+for i in range(0, column_size):
+    device_id = "root.sg%d.%d" % (i % 8, i)
+    timestamps_ = []
+    values_ = []
+    for t in range(0, row_size):
+        timestamps_.append(t)
+        # values_.append([-2 + 6 * random.random(), True])
+        values_.append(one_value)
+
+    tablet_ = Tablet(device_id, measurements_, data_types_, values_, timestamps_)
+    cost_st = time.perf_counter()
+    session.insert_tablet(tablet_)
+    insert_cost += time.perf_counter() - cost_st
+
+end = time.perf_counter()
+print("use time: %.3f" % (end - st))
+print("insert time: %.3f" % insert_cost)
+print("All executions done!!")
+# assert
+for i in range(0, column_size):
+    device_id = "root.sg%d.%d" % (i % 8, i)
+
+    session_data_set = session.execute_query_statement("select * from " + device_id)
+    session_data_set.set_fetch_size(row_size)
+    while session_data_set.has_next():
+        print(session_data_set.next())
+    session_data_set.close_operation_handle()
+
+session.close()
+
+print("Assert successfully")
diff --git a/client-py/iotdb/Session.py b/client-py/iotdb/Session.py
index 5db100a..c3c685c 100644
--- a/client-py/iotdb/Session.py
+++ b/client-py/iotdb/Session.py
@@ -84,6 +84,7 @@ class Session(object):
         self.__session_id = None
         self.__statement_id = None
         self.__zone_id = zone_id
+        self.values_in_bytes = None
 
     def open(self, enable_rpc_compression):
         if not self.__is_close:
@@ -403,13 +404,18 @@ class Session(object):
     def gen_insert_record_req(
         self, device_id, timestamp, measurements, data_types, values
     ):
+        # if self.values_in_bytes != None:
+        #     return TSInsertRecordReq(
+        #         self.__session_id, device_id, measurements, self.values_in_bytes, timestamp
+        #     )
         if (len(values) != len(data_types)) or (len(values) != len(measurements)):
             raise RuntimeError(
                 "length of data types does not equal to length of values!"
             )
-        values_in_bytes = Session.value_to_bytes(data_types, values)
+        self.values_in_bytes = Session.value_to_bytes(data_types, values)
+
         return TSInsertRecordReq(
-            self.__session_id, device_id, measurements, values_in_bytes, timestamp
+            self.__session_id, device_id, measurements, self.values_in_bytes, timestamp
         )
 
     def gen_insert_str_record_req(
diff --git a/client-py/iotdb/utils/IoTDBConstants.py b/client-py/iotdb/utils/IoTDBConstants.py
index ff92773..1aeda87 100644
--- a/client-py/iotdb/utils/IoTDBConstants.py
+++ b/client-py/iotdb/utils/IoTDBConstants.py
@@ -51,3 +51,6 @@ class Compressor(Enum):
     PAA = 5
     PLA = 6
     LZ4 = 7
+
+# UseNew=True
+# UseNew=False
\ No newline at end of file
diff --git a/client-py/iotdb/utils/Tablet.py b/client-py/iotdb/utils/Tablet.py
index 667adcb..ea6e456 100644
--- a/client-py/iotdb/utils/Tablet.py
+++ b/client-py/iotdb/utils/Tablet.py
@@ -19,10 +19,11 @@
 import struct
 
 from iotdb.utils.IoTDBConstants import TSDataType
+# from iotdb.utils.IoTDBConstants import UseNew
 
 
 class Tablet(object):
-    def __init__(self, device_id, measurements, data_types, values, timestamps):
+    def __init__(self, device_id, measurements, data_types, values, timestamps, use_new=False):
         """
         creating a tablet for insertion
           for example, considering device: root.sg1.d1
@@ -57,6 +58,7 @@ class Tablet(object):
         self.__data_types = data_types
         self.__row_number = len(timestamps)
         self.__column_number = len(measurements)
+        self.__use_new = use_new
 
     @staticmethod
     def check_sorted(timestamps):
@@ -78,54 +80,66 @@ class Tablet(object):
         return self.__device_id
 
     def get_binary_timestamps(self):
-        format_str_list = [">"]
-        values_tobe_packed = []
-        for timestamp in self.__timestamps:
-            format_str_list.append("q")
-            values_tobe_packed.append(timestamp)
+        if not self.__use_new:
+            format_str_list = [">"]
+            values_tobe_packed = []
+            for timestamp in self.__timestamps:
+                format_str_list.append("q")
+                values_tobe_packed.append(timestamp)
 
-        format_str = "".join(format_str_list)
-        return struct.pack(format_str, *values_tobe_packed)
+            format_str = "".join(format_str_list)
+            return struct.pack(format_str, *values_tobe_packed)
+        else:
+            return self.__timestamps.tobytes()
 
     def get_binary_values(self):
-        format_str_list = [">"]
-        values_tobe_packed = []
-        for i in range(self.__column_number):
-            if self.__data_types[i] == TSDataType.BOOLEAN:
-                format_str_list.append(str(self.__row_number))
-                format_str_list.append("?")
-                for j in range(self.__row_number):
-                    values_tobe_packed.append(self.__values[j][i])
-            elif self.__data_types[i] == TSDataType.INT32:
-                format_str_list.append(str(self.__row_number))
-                format_str_list.append("i")
-                for j in range(self.__row_number):
-                    values_tobe_packed.append(self.__values[j][i])
-            elif self.__data_types[i] == TSDataType.INT64:
-                format_str_list.append(str(self.__row_number))
-                format_str_list.append("q")
-                for j in range(self.__row_number):
-                    values_tobe_packed.append(self.__values[j][i])
-            elif self.__data_types[i] == TSDataType.FLOAT:
-                format_str_list.append(str(self.__row_number))
-                format_str_list.append("f")
-                for j in range(self.__row_number):
-                    values_tobe_packed.append(self.__values[j][i])
-            elif self.__data_types[i] == TSDataType.DOUBLE:
-                format_str_list.append(str(self.__row_number))
-                format_str_list.append("d")
-                for j in range(self.__row_number):
-                    values_tobe_packed.append(self.__values[j][i])
-            elif self.__data_types[i] == TSDataType.TEXT:
-                for j in range(self.__row_number):
-                    value_bytes = bytes(self.__values[j][i], "utf-8")
+        if not self.__use_new:
+            format_str_list = [">"]
+            values_tobe_packed = []
+            for i in range(self.__column_number):
+                if self.__data_types[i] == TSDataType.BOOLEAN:
+                    format_str_list.append(str(self.__row_number))
+                    format_str_list.append("?")
+                    for j in range(self.__row_number):
+                        values_tobe_packed.append(self.__values[j][i])
+                elif self.__data_types[i] == TSDataType.INT32:
+                    format_str_list.append(str(self.__row_number))
                     format_str_list.append("i")
-                    format_str_list.append(str(len(value_bytes)))
-                    format_str_list.append("s")
-                    values_tobe_packed.append(len(value_bytes))
-                    values_tobe_packed.append(value_bytes)
-            else:
-                raise RuntimeError("Unsupported data type:" + str(self.__data_types[i]))
-
-        format_str = "".join(format_str_list)
-        return struct.pack(format_str, *values_tobe_packed)
+                    for j in range(self.__row_number):
+                        values_tobe_packed.append(self.__values[j][i])
+                elif self.__data_types[i] == TSDataType.INT64:
+                    format_str_list.append(str(self.__row_number))
+                    format_str_list.append("q")
+                    for j in range(self.__row_number):
+                        values_tobe_packed.append(self.__values[j][i])
+                elif self.__data_types[i] == TSDataType.FLOAT:
+                    format_str_list.append(str(self.__row_number))
+                    format_str_list.append("f")
+                    for j in range(self.__row_number):
+                        values_tobe_packed.append(self.__values[j][i])
+                elif self.__data_types[i] == TSDataType.DOUBLE:
+                    format_str_list.append(str(self.__row_number))
+                    format_str_list.append("d")
+                    for j in range(self.__row_number):
+                        values_tobe_packed.append(self.__values[j][i])
+                elif self.__data_types[i] == TSDataType.TEXT:
+                    for j in range(self.__row_number):
+                        value_bytes = bytes(self.__values[j][i], "utf-8")
+                        format_str_list.append("i")
+                        format_str_list.append(str(len(value_bytes)))
+                        format_str_list.append("s")
+                        values_tobe_packed.append(len(value_bytes))
+                        values_tobe_packed.append(value_bytes)
+                else:
+                    raise RuntimeError("Unsupported data type:" + str(self.__data_types[i]))
+
+            format_str = "".join(format_str_list)
+            return struct.pack(format_str, *values_tobe_packed)
+        else:
+            ret = []
+            for i in range(self.__column_number):
+                # if self.__data_types[i] == TSDataType.FLOAT:
+                ret.append(self.__values.tobytes())
+                # else:
+                #     raise RuntimeError("Unsupported data type:" + str(self.__data_types[i]))
+            return ret
diff --git a/client-py/tablet_performance_comparison.py b/client-py/tablet_performance_comparison.py
new file mode 100644
index 0000000..afac6d2
--- /dev/null
+++ b/client-py/tablet_performance_comparison.py
@@ -0,0 +1,127 @@
+# 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.
+#
+
+# Uncomment the following line to use apache-iotdb module installed by pip3
+
+from iotdb.Session import Session
+from iotdb.utils.IoTDBConstants import TSDataType
+from iotdb.utils.Tablet import Tablet
+import random
+import numpy as np
+import time
+
+
+def create_open_session():
+    # creating session connection.
+    ip = "127.0.0.1"
+    port_ = "6667"
+    username_ = "root"
+    password_ = "root"
+    session = Session(ip, port_, username_, password_, fetch_size=1024, zone_id="UTC+8")
+    session.open(False)
+    return session
+
+
+def check_count(expect, _session, _sql):
+    session_data_set = _session.execute_query_statement(_sql)
+    session_data_set.set_fetch_size(1)
+    get_count_line = False
+    while session_data_set.has_next():
+        if get_count_line:
+            assert False, "select count return more than one line"
+        line = session_data_set.next()
+        assert expect == line.get_fields()[0].get_long_value(), "count result error"
+        get_count_line = True
+    if not get_count_line:
+        assert False, "select count has no result"
+    session_data_set.close_operation_handle()
+
+
+def performance_test(data_types=tuple([TSDataType.FLOAT]), use_new=True, valid_result=False, row=10000, col=2000,
+                     seed=0):
+    session = create_open_session()
+    st = time.perf_counter()
+    random.seed(a=seed, version=2)
+    insert_cost = 0
+
+    VALUES_OF_TYPES = {TSDataType.BOOLEAN: True,
+                       TSDataType.DOUBLE: 1.234567,
+                       TSDataType.FLOAT: 1.2,
+                       TSDataType.INT32: 100,
+                       TSDataType.INT64: 123456789098,
+                       TSDataType.TEXT: "test_record"}
+    FORMAT_CHAR_OF_TYPES = {TSDataType.BOOLEAN: "?",
+                            TSDataType.DOUBLE: "d",
+                            TSDataType.FLOAT: "f",
+                            TSDataType.INT32: "i",
+                            TSDataType.INT64: "q",
+                            TSDataType.TEXT: str}
+
+    type_len = len(data_types)
+    measurements_ = ["s" + str(i) for i in range(type_len)]
+
+    for i in range(0, col):
+        device_id = "root.sg%d.%d" % (i % 8, i)
+
+        if not use_new:
+            timestamps_ = []
+            values_ = []
+            for t in range(0, row):
+                timestamps_.append(t)
+                value_ = []
+                for data_type in data_types:
+                    value_.append(VALUES_OF_TYPES[data_type])
+                values_.append(value_)
+        else:
+            timestamps_ = np.zeros(row, dtype='>q')
+            values_ = [np.zeros(row, dtype=FORMAT_CHAR_OF_TYPES[data_type]) for data_type in data_types]
+            for t in range(0, row):
+                timestamps_[t] = t
+                for j, data_type in enumerate(data_types):
+                    values_[j][t] = VALUES_OF_TYPES[data_type]
+
+        tablet_ = Tablet(device_id, measurements_, data_types, values_, timestamps_, use_new=use_new)
+        cost_st = time.perf_counter()
+        session.insert_tablet(tablet_)
+        insert_cost += time.perf_counter() - cost_st
+        if valid_result:
+            # query total line
+            print("execute query for validation")
+            check_count(row, session, "select count(*) from %s" % device_id)
+            # query the first
+            check_query_result(, session, "select count(*) from %s" % device_id)
+            # query the last
+            print("query validation have passed")
+
+    session.close()
+    end = time.perf_counter()
+
+    print("All executions done!!")
+    print("use time: %.3f" % (end - st))
+    print("insert time: %.3f" % insert_cost)
+
+
+valid_result = True
+performance_test(data_types=tuple([TSDataType.FLOAT]), use_new=False, valid_result=valid_result, row=3, col=1)
+# performance_test(data_types=tuple([TSDataType.FLOAT]), use_new=True, valid_result=valid_result)
+
+# performance_test(data_types=tuple([TSDataType.BOOLEAN, TSDataType.FLOAT, TSDataType.DOUBLE, TSDataType.INT32, TSDataType.INT64]), use_new=False, valid_result=valid_result)
+# performance_test(data_types=tuple([TSDataType.BOOLEAN, TSDataType.FLOAT, TSDataType.DOUBLE, TSDataType.INT32, TSDataType.INT64]), use_new=True, valid_result=valid_result)
+#
+# performance_test(data_types=tuple([TSDataType.BOOLEAN, TSDataType.FLOAT, TSDataType.DOUBLE, TSDataType.INT32, TSDataType.INT64, TSDataType.TEXT]), use_new=False, valid_result=valid_result)
+# performance_test(data_types=tuple([TSDataType.BOOLEAN, TSDataType.FLOAT, TSDataType.DOUBLE, TSDataType.INT32, TSDataType.INT64, TSDataType.TEXT]), use_new=True, valid_result=valid_result)
diff --git a/client-py/zzz_SessionInsertRecord.py b/client-py/zzz_SessionInsertRecord.py
new file mode 100644
index 0000000..5458c60
--- /dev/null
+++ b/client-py/zzz_SessionInsertRecord.py
@@ -0,0 +1,123 @@
+# 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.
+#
+
+# Uncomment the following line to use apache-iotdb module installed by pip3
+
+from iotdb.Session import Session
+from iotdb.utils.IoTDBConstants import TSDataType, TSEncoding, Compressor
+from iotdb.utils.Tablet import Tablet
+
+# creating session connection.
+ip = "127.0.0.1"
+port_ = "6667"
+username_ = "root"
+password_ = "root"
+session = Session(ip, port_, username_, password_, fetch_size=1024, zone_id="UTC+8")
+session.open(False)
+
+# set and delete storage groups
+session.set_storage_group("root.sg_test_01")
+session.set_storage_group("root.sg_test_02")
+session.set_storage_group("root.sg_test_03")
+session.set_storage_group("root.sg_test_04")
+session.delete_storage_group("root.sg_test_02")
+session.delete_storage_groups(["root.sg_test_03", "root.sg_test_04"])
+
+# setting time series.
+session.create_time_series(
+    "root.sg_test_01.d_01.s_01", TSDataType.BOOLEAN, TSEncoding.PLAIN, Compressor.SNAPPY
+)
+session.create_time_series(
+    "root.sg_test_01.d_01.s_02", TSDataType.INT32, TSEncoding.PLAIN, Compressor.SNAPPY
+)
+session.create_time_series(
+    "root.sg_test_01.d_01.s_03", TSDataType.INT64, TSEncoding.PLAIN, Compressor.SNAPPY
+)
+
+# setting multiple time series once.
+ts_path_lst_ = [
+    "root.sg_test_01.d_01.s_04",
+    "root.sg_test_01.d_01.s_05",
+    "root.sg_test_01.d_01.s_06",
+    "root.sg_test_01.d_01.s_07",
+    "root.sg_test_01.d_01.s_08",
+    "root.sg_test_01.d_01.s_09",
+]
+data_type_lst_ = [
+    TSDataType.FLOAT,
+    TSDataType.DOUBLE,
+    TSDataType.TEXT,
+    TSDataType.FLOAT,
+    TSDataType.DOUBLE,
+    TSDataType.TEXT,
+]
+encoding_lst_ = [TSEncoding.PLAIN for _ in range(len(data_type_lst_))]
+compressor_lst_ = [Compressor.SNAPPY for _ in range(len(data_type_lst_))]
+session.create_multi_time_series(
+    ts_path_lst_, data_type_lst_, encoding_lst_, compressor_lst_
+)
+
+# delete time series
+session.delete_time_series(
+    [
+        "root.sg_test_01.d_01.s_07",
+        "root.sg_test_01.d_01.s_08",
+        "root.sg_test_01.d_01.s_09",
+    ]
+)
+
+# checking time series
+print(
+    "s_07 expecting False, checking result: ",
+    session.check_time_series_exists("root.sg_test_01.d_01.s_07"),
+)
+print(
+    "s_03 expecting True, checking result: ",
+    session.check_time_series_exists("root.sg_test_01.d_01.s_03"),
+)
+
+# insert one record into the database.
+measurements_ = ["s_01", "s_02", "s_03", "s_04", "s_05", "s_06"]
+values_ = [False, 10, 11, 1.1, 10011.1, "test_record"]
+data_types_ = [
+    TSDataType.BOOLEAN,
+    TSDataType.INT32,
+    TSDataType.INT64,
+    TSDataType.FLOAT,
+    TSDataType.DOUBLE,
+    TSDataType.TEXT,
+]
+
+import time
+
+st = time.perf_counter()
+last_time = st
+total_count = 1_000_000
+
+for i in range(total_count):
+    if i % 10000 == 0:
+        now = time.perf_counter()
+        print("write %d, use time: %.3f" % (i, now - last_time))
+        last_time = now
+    session.insert_record("root.sg_test_01.d_01", i, measurements_, data_types_, values_)
+end = time.perf_counter()
+# close session connection.
+session.close()
+
+print("All executions done!!")
+print("write %d, total time: %.3f" % (total_count, end - st))
diff --git a/client-py/zzz_TestIOTDb.py b/client-py/zzz_TestIOTDb.py
new file mode 100644
index 0000000..d1d1e19
--- /dev/null
+++ b/client-py/zzz_TestIOTDb.py
@@ -0,0 +1,104 @@
+# import argparse
+# import datetime
+# import random
+#
+# import numpy
+# import pandas as pd
+# import time
+#
+# from iotdb.Session import Session
+#
+# from iotdb.utils.IoTDBConstants import TSDataType
+# from iotdb.utils.Tablet import Tablet
+#
+# # from mertic.utils.iotdb_helper import resultset_to_pandas
+# # from mertic.common import setting
+# from datetime import datetime
+# import time
+#
+# def insertRecordData():
+#     # session = setting.get_IoTDB_session()
+#     ip = "127.0.0.1"
+#     port_ = "6667"
+#     username_ = "root"
+#     password_ = "root"
+#     session = Session(ip, port_, username_, password_, fetch_size=1024, zone_id="UTC+8")
+#     session.open(False)
+#     listtablet = []
+#     for i in range(2000, 4000):
+#         sgnum = int(i) % 8
+#         k = 0
+#         time = 1621250000 + i
+#         json_body = [
+#         ]
+#         tsd=[]
+#         for t in range(10080):
+#             k = k + 1
+#             time = 1621250000 + k * 60
+#             subtsd = []
+#
+#             subtsd.append(int(time*1000))
+#             subtsd.append(random.uniform(-2, 4))
+#             subtsd.append(True)
+#             tsd.append(subtsd)
+#
+#         # print(tsd[:,0])
+#         # break
+#         tsd=numpy.array(tsd)
+#         device_id = "root.sg" + str(sgnum) + "." + str(i)
+#         measurements = [setting.LABEL_TSD_VALUE, setting.LABEL_TSD_ISTRUE]
+#         data_types = [TSDataType.FLOAT, TSDataType.BOOLEAN]
+#         values = numpy.array(tsd)[:, 1:]
+#         times = [int(x) for x in tsd[:, 0]]
+#         tablet=Tablet(device_id,measurements,data_types,values,times)
+#
+#         listtablet.append(tablet)
+#
+#         session.insert_tablets(listtablet)
+#         listtablet=[]
+#
+#         # session.insert_records(["root.sg"+str(sgnum)+"."+str(i)]*len(tsd),
+#         #                     [int(x) for x in tsd[:,0]],
+#         #                     [[setting.LABEL_TSD_VALUE, setting.LABEL_TSD_ISTRUE]]*len(tsd),
+#         #                     [[TSDataType.FLOAT, TSDataType.BOOLEAN]]*len(tsd),
+#         #                     numpy.array(tsd)[:,1:])
+#
+#     session.close()
+#
+#
+#
+# def testiotdb():
+#     session = setting.get_IoTDB_session()
+#     session.open(False)
+#     metric_meta_data = session.execute_query_statement(
+#         "select metricID, LastUpdateTime, grain, LastTimeofLocal from root.meta")
+#     metric_meta_data = resultset_to_pandas(metric_meta_data)
+#     del metric_meta_data['Time']
+#     metric_meta_data.columns = [setting.LABEL_METRIC_ID, setting.LABEL_METRIC_LASTUPDATETIME, setting.LABEL_TSD_GRAIN,
+#                                 setting.LABEL_METRIC_LASTTIMEOFLOCAL]
+#     session.close()
+# def queryData():
+#
+#     for i in range(2000,4000):
+#         session = setting.get_IoTDB_session()
+#         session.open(False)
+#         sgnum = int(i) % 8
+#
+#         metric_meta_data = session.execute_query_statement(
+#             "select time,value,is_true from root.sg"+str(sgnum)+"."+str(i))
+#         # metric_meta_data = resultset_to_pandas(metric_meta_data)
+#         # print(metric_meta_data)
+#         print(i)
+#         session.close()
+#
+# if __name__ == '__main__':
+#     #args = parse_args()
+#     #main(host=args.host, port=args.port)
+#     #insertData()
+#     #queryData(0,2000,1619193180000,1619193180000)
+#     a = datetime.now()  # 获得当前时间
+#     insertRecordData()
+#     b = datetime.now()  # 获取当前时间
+#     durn = (b - a).seconds  # 两个时间差,并以秒显示出来
+#     print(durn)
+#     print("--------")
\ No newline at end of file
diff --git a/client-py/zzz_debugInsertRecord.py b/client-py/zzz_debugInsertRecord.py
new file mode 100644
index 0000000..6d8d0e7
--- /dev/null
+++ b/client-py/zzz_debugInsertRecord.py
@@ -0,0 +1,28 @@
+from iotdb.Session import Session
+from iotdb.utils.IoTDBConstants import TSDataType, TSEncoding, Compressor
+
+# creating session connection.
+ip = "127.0.0.1"
+port_ = "6667"
+username_ = "root"
+password_ = "root"
+session = Session(ip, port_, username_, password_, fetch_size=1024, zone_id="UTC+8")
+session.open(False)
+
+
+# setting time series.
+session.create_time_series("root.dj.d_01.temperature", TSDataType.FLOAT, TSEncoding.PLAIN, Compressor.SNAPPY)
+session.create_time_series("root.dj.d_01.status", TSDataType.BOOLEAN, TSEncoding.PLAIN, Compressor.SNAPPY)
+
+# insert one record into the database.
+measurements_ = ["temperature", "status"]
+values_ = [19.01, True]
+data_types_ = [
+    TSDataType.FLOAT,
+    TSDataType.BOOLEAN,
+]
+device_id = "root.dj.d_01"
+session.insert_record(device_id, 2, measurements_, data_types_, values_)
+
+session.execute_non_query_statement("insert into root.sg_test_01.wf02.wf01(timestamp, temperature, status) values(now(), 20.00, True)")
+session.close()
diff --git a/client-py/zzz_main.py b/client-py/zzz_main.py
new file mode 100644
index 0000000..981a983
--- /dev/null
+++ b/client-py/zzz_main.py
@@ -0,0 +1,22 @@
+import struct
+import numpy as np
+
+format_str = '>2f'
+ret = struct.pack(format_str, *[1., 1.])
+print(ret)
+print(type(ret))
+
+ret = np.array([1., 1.], dtype='>f').tobytes()
+print(ret)
+print(type(ret))
+
+
+format_str = '>2q'
+ret = struct.pack(format_str, *[123321, 123123])
+print(ret)
+print(type(ret))
+
+ret = np.array([123321, 123123], dtype='>q').tobytes()
+print(ret)
+print(type(ret))
+
diff --git a/example/session/src/main/java/org/apache/iotdb/TestSession.java b/example/session/src/main/java/org/apache/iotdb/TestSession.java
new file mode 100644
index 0000000..2351dc5
--- /dev/null
+++ b/example/session/src/main/java/org/apache/iotdb/TestSession.java
@@ -0,0 +1,100 @@
+package org.apache.iotdb;
+
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.List;
+import java.util.Random;
+
+import org.apache.iotdb.session.Session;
+import org.apache.iotdb.tsfile.file.metadata.enums.TSDataType;
+import org.apache.iotdb.tsfile.write.record.Tablet;
+import org.apache.iotdb.tsfile.write.schema.IMeasurementSchema;
+import org.apache.iotdb.tsfile.write.schema.MeasurementSchema;
+
+public class TestSession {
+
+  public static void main(String[] args) throws Exception {
+    Session session = new Session("127.0.0.1", 6667, "root", "root");
+    session.open();
+//        session.setStorageGroup("root.sestest");
+//        session.createTimeseries("root.sestest.wf01.wt01.s0", TSDataType.INT32, TSEncoding.RLE, CompressionType.SNAPPY);
+//        session.createTimeseries("root.sestest.wf01.wt01.s1", TSDataType.INT32, TSEncoding.RLE, CompressionType.SNAPPY);
+//        session.createTimeseries("root.sestest.wf01.wt01.s2", TSDataType.INT32, TSEncoding.RLE, CompressionType.SNAPPY);
+
+    Date d = new Date();
+    Random r = new Random(0);
+    long insertCost = 0;
+    for (int i = 2000; i < 4000; i++) {
+//      Calendar c = Calendar.getInstance();
+//      c.setTime(d);
+      String deviceId = "root.sg" + i % 8 + "." + i;
+//      List<List<String>> measurementsList = new ArrayList<List<String>>();
+//      List<List<TSDataType>> typesList = new ArrayList<List<TSDataType>>();
+//      List<List<Object>> valuesList = new ArrayList<List<Object>>();
+//      List<Long> times = new ArrayList<Long>();
+//      List<String> deviceIds = new ArrayList<String>();
+
+      MeasurementSchema mes = new MeasurementSchema("s1", TSDataType.FLOAT);
+      MeasurementSchema mes1 = new MeasurementSchema("is_true", TSDataType.BOOLEAN);
+
+      List<IMeasurementSchema> schemas = new ArrayList<>();
+      schemas.add(mes);
+//      schemas.add(mes1);
+      int rowSize = 10080;
+//      int rowSize = 5080;
+      Tablet ta = new Tablet(deviceId, schemas, rowSize);
+      ta.rowSize = rowSize;
+      for (int t = 0; t < ta.rowSize; t++) {
+//					Random r=new Random();
+//					 List<String> measurement = new ArrayList<>();
+//					List<Object> values = new ArrayList<>(3);
+//		            List<TSDataType> types = new ArrayList<>(3);
+//		            times.add(c.getTimeInMillis());
+//		            values.add(-2+6*r.nextFloat());
+//		            types.add(TSDataType.FLOAT);
+//		            values.add(true);
+//		            types.add(TSDataType.BOOLEAN);
+//		            measurement.add("s1");
+//		            measurement.add("is_true");
+//		            typesList.add(types);
+//		            valuesList.add(values);
+//		            deviceIds.add(deviceId);
+//		            measurementsList.add(measurement);
+//					c.add(Calendar.MINUTE,+i);
+
+//					 List<String> measurement = new ArrayList<>();
+//					List<Object> values = new ArrayList<>(3);
+//		            List<TSDataType> types = new ArrayList<>(3);
+//		           
+//		            values.add(-2+6*r.nextFloat());
+//		            types.add(TSDataType.FLOAT);
+//		            values.add(true);
+//		            types.add(TSDataType.BOOLEAN);
+//		            measurement.add("s1");
+//		            measurement.add("is_true");
+//		            typesList.add(types);
+//		            valuesList.add(values);
+//		            deviceIds.add(deviceId);
+//		            measurementsList.add(measurement);
+//        ta.addTimestamp(t, c.getTimeInMillis());
+        ta.addTimestamp(t, t);
+//        ta.addValue("is_true", t, true);
+//        ta.addValue("s1", t, -2 + 6 * r.nextFloat());
+        ta.addValue("s1", t, -2 + 6 * 0.5f);
+//        c.add(Calendar.MINUTE, +1);
+      }
+      long st = System.nanoTime();
+      session.insertTablet(ta, true);
+      insertCost += (System.nanoTime() - st);
+      //session.insertRecords(deviceIds, times, measurementsList, typesList, valuesList);
+    }
+    session.close();
+    Date d1 = new Date();
+    System.out.println(d1.getTime() - d.getTime());
+    System.out.println(insertCost / 1000_000);
+
+
+  }
+
+}