ADR 0004: Time-Series Database — TDengine¶
Status¶
Accepted
Date¶
2026-07-24
Context¶
OVES operates IoT devices globally (battery sensors, charging stations, swap cabinets, vehicle GPS/BMS). Time-series data from these devices was stored in InfluxDB on a self-managed AWS EC2 instance. This architecture had:
- Fixed cost from always-on EC2 (not usage-based)
- Operational overhead from EC2 maintenance, InfluxDB upgrades, and backup management
- Cross-cloud egress when IoT data needed to be analyzed or archived elsewhere
InfluxDB Cloud Serverless (pay-as-you-go) and TDengine were evaluated as replacements.
Decision¶
TDengine (self-hosted on Tencent CVM) replaces InfluxDB on AWS EC2.
Configuration¶
| Parameter | Value |
|---|---|
| Deployment | Tencent CVM, Guangzhou region |
| Initial spec | 4-core / 16 GB RAM / 200 GB SSD |
| High availability | Raft 3-replica (enabled at production scale) |
| Edge deployment | TDengine ARM binary with store-and-forward sync |
Data Lifecycle¶
IoT Sensor → MQTT → Edge TDengine → (auto-sync) → Cloud TDengine
│
30d: hot (SSD)
90d: warm (HDD)
>90d: CSV dump → COS Deep Archive
Migration Path¶
| Area | Effort | Approach |
|---|---|---|
| Data ingest | Zero code change | taosAdapter natively accepts InfluxDB line protocol |
| Query rewrite | ~1 week | InfluxQL/Flux → Standard SQL |
| Grafana dashboards | No change | TDengine Grafana plugin; same dashboard definitions |
| Telegraf | No change | taosAdapter natively supports Telegraf output |
Performance Comparison (4C/16G)¶
| Metric | TDengine | InfluxDB |
|---|---|---|
| Write throughput | 3,000,000+ points/s | ~300,000 points/s |
| Storage compression | 5–10% of raw | 20–30% of raw |
| Complex query speed | 37× faster (TSBS benchmark) | baseline |
| Daily storage (10K devices) | ~500 MB | ~2 GB |
Rejected Alternative¶
| Alternative | Reason for Rejection |
|---|---|
| InfluxDB Cloud Serverless | Pay-per-byte pricing grows with data volume; no China region; no edge sync; no High Availability in free tier |
Consequences¶
Benefits¶
- 10× write performance with 75% less disk usage
- Fixed, predictable cost: CVM ¥500–800/month vs. EC2 $200–500/month
- Zero cross-cloud egress: TDengine CVM → COS (same region, free intra-cloud)
- Native edge-cloud sync for global IoT deployment
- Chinese ecosystem: local support, Chinese documentation, no GFW latency
- Open source (AGPLv3): no vendor lock-in, free to start
Trade-Offs¶
- Self-managed: requires CVM provisioning and maintenance (1–2 days initial setup)
- Smaller ecosystem than InfluxDB: fewer Grafana dashboard templates, no native Telegraf plugin library (mitigated by taosAdapter compatibility layer)
- TDengine Cloud managed service runs on Alibaba Cloud, not Tencent — self-hosting on CVM is the recommended path
- Query migration: 1 week of developer effort to rewrite InfluxQL/Flux to SQL
Supersedes¶
None.
Superseded By¶
None.