SmartHome Server: High-Performance MQTT Simulator & Benchmark / 高性能 MQTT 智能家居仿真系统
🔬 Project Overview / 项目概览
Secure and scalable communication is critical in modern IoT ecosystems. SmartHome_Server is a specialized tool designed to verify, benchmark, and simulate secure MQTT environments.
在现代物联网(IoT)生态系统中,安全且可扩展的通信至关重要。SmartHome_Server 是一个专用于验证、基准测试和仿真安全 MQTT 环境的专业工具。
Originally developed for academic research at CTU, it focuses on solving a key problem: How to test IoT middleware scalability without purchasing thousands of physical devices?
该项目最初为 CVUT 的学术研究而开发,旨在解决一个核心问题:如何在不购买数千个物理设备的情况下测试 IoT 中间件的扩展性?
🚀 Key Features / 核心特性
1. High-Concurrency Simulation / 高并发仿真
The system uses Python’s asyncio to spawn thousands of virtual “Actors”. Each Actor behaves like a real physical device:
系统利用 Python 的 asyncio 生成数千个虚拟“Actor”。每个 Actor 都像真实的物理设备一样运行:
- Sensors: Periodically publish data (Temperature, Humidity) with configurable patterns (Drift, Sine Wave).
- Actuators: Subscribe to command topics and respond to state changes (Switches, Lights).
2. Mutual TLS (mTLS) Benchmarking / 双向 TLS 基准测试
Security often comes at the cost of performance. This tool allows engineers to quantify that cost. It includes a complete PKI (Public Key Infrastructure) script to generate:
安全往往以牺牲性能为代价。此工具允许工程师量化这一成本。它包含一个完整的 PKI(公钥基础设施)脚本,用于生成:
- Root CA
- Server Certificates
- Client Certificates for thousands of simulated devices
3. Home Assistant Integration / Home Assistant 集成
The simulator implements the Home Assistant MQTT Discovery protocol.
该仿真器实现了 Home Assistant MQTT Discovery 协议。
Use Case:
- Launch the simulator with
--ha-discovery. - Open your Home Assistant dashboard.
- Instantly see 1,000+ new devices appear, allowing you to test HA’s rendering performance and rule engine load.
📊 Benchmarking Methodology / 基准测试方法
The system measures performance metrics with high precision:
该系统能够高精度地测量性能指标:
- Handshake Latency: Time taken to complete the TLS handshake.
- Message RTT: Round-trip time from Publisher -> Broker -> Subscriber.
- CPU/RAM Overhead: Resource consumption of the broker (e.g., EMQX vs Mosquitto) under load.
Example Command
# Simulate 500 sensors aiming at a local broker |
📥 Get Started / 开始使用
Whether for academic research or industrial load testing, SmartHome_Server provides the necessary tooling to validate your IoT infrastructure.
无论是用于学术研究还是工业负载测试,SmartHome_Server 都提供了验证 IoT 基础设施所需的工具。