Help Center/ MapReduce Service/ Component Development Specifications/ IoTDB/ IoTDB Application Development Suggestions
Updated on 2024-08-30 GMT+08:00

IoTDB Application Development Suggestions

Use the Native Session API to Avoid SQL Concatenation

For the sample of calling the IoTDB Session API in a cluster in security mode, see IoTDB Session. For that in a cluster in common mode, see IoTDB Session.

Use Write APIs with High Performance Based on Service Requirements

The write APIs are ranked as follows in descending order of their performance:

insertTablets (inserts multiple tablets, from multiple rows of the same column on multiple devices) >

insertTablet (inserts a tablet, from multiple rows of the same column on a single device) >

insertRecordsOfOneDevice (inserts multiple records, from multiple rows of different columns on a single device) >

insertRecords(Object value) (inserts multiple records, from multiple rows of different columns on multiple devices) >

insertRecords(String value) (inserts multiple records, from multiple rows of different columns on multiple devices) >

insertRecord (inserts a record, from only one row on a single device)

Do Not Use the Same Client to Initiate Concurrent Connections

An IoTDB client can connect to only one IoTDBServer. A large number of concurrent connections from the same client to IoTDBServer will deteriorate the connection performance. You can use multiple clients to connect to IoTDBServer based on service requirements to achieve load balancing.

Use SessionPool to Reuse Connections

Use the distributed technology to cache sessions so that the client does not need to create sessions for each read or write request. Alternatively, use SessionPool to reuse connections.

Close ResultSet and SessionDataSet in a Timely Manner

Close ResultSet and SessionDataSet in a timely manner to avoid resource wastes.