Web Cluster Architecture
About 1 min
Web Cluster Architecture
Overall architecture:

Detailed architecture:

1. Client Layer
- Browsers, mobile apps, and third-party systems access the platform through HTTP/HTTPS.
2. Load Balancing Layer
- Nginx cluster:
- Reverse proxy and backend load balancing.
- SSL termination and static resource caching.
- Horizontal scaling for high availability.
3. Application Service Layer
- Spring Boot service cluster:
- Provides RESTful APIs and handles business logic.
- Multiple instances are deployed horizontally and balanced through Nginx.
4. Message Queue Layer
- Kafka cluster:
- Topics can be split into multiple partitions, such as
Partition 1andPartition 2. - Consumes device data from the FMQ cluster, including MQTT/TCP/UDP service clusters.
- Device gateway services write data into Kafka.
- Spring Boot services consume Kafka data and process device commands, alarms, and other business events.
- Topics can be split into multiple partitions, such as
5. Data Processing Layer
- Rule engine:
- LiteFlow executes scene-automation rules such as device linkage and alarm triggers.
- Ignite stores and manages LiteFlow rule configuration and supports dynamic updates.
- Distributed scheduling:
- Quartz cluster runs Modbus polling jobs and coordinates cluster tasks through database locks.
6. Cache and Metadata Layer
- Distributed cache:
- Ignite cluster caches device metadata such as device IDs, status, and configuration.
- Integration with Spring Boot provides low-latency metadata access.
- Redis primary-replica architecture:
- The primary node handles writes such as session state and real-time counters.
- Replica nodes handle reads and can be combined with Sentinel for automatic failover.
7. Data Storage Layer
- Relational database:
- MySQL primary-replica architecture, where the primary handles transactional writes and replicas handle queries.
- Time-series database:
- TDengine stores historical device data such as temperature and humidity and supports efficient time-series queries.
8. Device Access Layer
- Protocol gateway:
- Supports MQTT/TCP/UDP protocol access.
- Forwards device data to the Kafka cluster.
Key Design Points
- High availability: critical components such as Nginx, Kafka, MySQL, and Redis use cluster or primary-replica deployment.
- Data flow: device data -> MQTT/TCP/UDP gateway -> Kafka -> Spring Boot services -> TDengine/MySQL.
- Performance: Ignite caches device metadata to reduce MySQL pressure, and TDengine optimizes time-series storage and queries.
- Scalability: Kafka partitions and Nginx load balancing provide horizontal scaling.
