- TDengine scales to support over 5,000 connected devices each collecting 19 metrics every second.
- Built-in data subscription enables a warning and alarm system without reliance on custom code or third-party solutions.
- Built-in caching functionality supports real-time dashboards with dynamic refreshing of the latest metrics.
A supplier of electric motors for applications such as industrial machinery, air conditioners, and elevators developed an IoT-based platform to monitor and maintain its products. This platform uses sensors and IoT gateways to collect operational and spectrum waveform data from each motor, combining this with big data modeling and analysis to identify potential risks and enable predictive maintenance.
Initially, a relational database management system (RDBMS) was intended to be used for data storage in this platform. And for a small number of devices — fewer than 100 — the RDBMS was up to the task. However, IoT monitoring of motors involves diverse data types and high-frequency data collection. Combined with the anticipated growth in their platform to over 5,000 motors, they faced difficulties with performance and stability.
RDBMS to TSDB
To accommodate future business growth and overcome these difficulties, the company decided to move their platform to a time-series database (TSDB). After evaluating several products, they selected TDengine for the following reasons:
- High performance with fast data ingestion and querying
- Clustered deployment with multiple replicas and horizontal scaling
- Easy installation with comprehensive documentation and straightforward deployment processes.
- Open source with an active community where many issues are resolved.
- User friendly with standard SQL for data operations.
The architecture of the company’s IoT platform including TDengine is described in the following figure.
Storage Model
Two supertables were created in TDengine to store time-series data for the platform. The super table for motor metrics was defined as follows:
CREATE STABLE IF NOT EXISTS general_view_escalator (
ts TIMESTAMP,
elect_machine_one FLOAT,
reducer_machine_one FLOAT,
bottom_bolt_one FLOAT,
elect_machine_two FLOAT,
reducer_machine_two FLOAT,
bottom_bolt_two FLOAT,
left_main_drive FLOAT,
right_main_drive FLOAT,
left_step_chain FLOAT,
right_step_chain FLOAT,
up_main_drive_noise FLOAT,
down_step_chain_work_noise FLOAT,
left_step_chain_extend FLOAT,
right_step_chain_extend FLOAT,
left_handrail_temperature FLOAT,
right_handrail_temperature FLOAT,
env_temperature FLOAT,
elect_machine_temperature FLOAT,
reduction_gearbox_one_oil FLOAT,
reduction_gearbox_two_oil FLOAT,
rmd FLOAT
) TAGS (line_id BINARY(20), site_id BINARY(20), elevator_code BINARY(20));
The supertable for waveform data was defined as follows:
CREATE STABLE IF NOT EXISTS waveform_view_escalator (
ts TIMESTAMP,
vals BINARY(16000),
samplehz INT,
len INT,
ratio INT
) TAGS (line_id BINARY(20), site_id BINARY(20), elevator_code BINARY(20), measuring_id BINARY(20));
The subtable for each motor is created automatically when data is ingested, allowing the system to scale without manual intervention.
Warning and alarm events are managed using TDengine’s built-in data subscription.
TDengine’s built-in caching was also used to enable dynamic data refresh and display for the latest motor metrics. The database was configured to cache the last record of each table, and the company’s application used the LAST_ROW
function to query the latest records in real time.
In the original project, many calculations were performed within the application itself. Now, TDengine takes on all of these tasks, reducing load on the company’s application and also enabling persistent storage of aggregated results to support fast queries of historical data.
Conclusion
On launch, the platform had 300 connected devices each collecting 19 metrics every second. The data is stored with greater granularity, providing more precise data support for intelligent diagnostics and analytics on the platform. Additionally, the query performance across various business scenarios exceeds expectations.