Welcome to the Smart Campus Distributed System project!
This project simulates a distributed edge–fog computing environment where smart campus buildings dynamically manage computational workloads using environmental sensor data.
The system demonstrates how multiple nodes collaborate to balance workloads before overload occurs, ensuring stability and performance transparency in a distributed environment.
Add screenshots of your dashboard here.
The system simulates a smart campus distributed computing environment composed of several nodes.
| Node | Role | Location |
|---|---|---|
| node1 | Edge Node | Library |
| node2 | Edge Node | Lecturer Office |
| node3 | Edge Node | Laboratory |
| node4 | Edge Node | Classroom |
| fog1 | Fog Node | Campus Fog Server |
Edge nodes represent smart buildings equipped with sensors.
Each node processes environmental data locally and generates workloads based on sensor readings.
The fog node acts as a central processing fallback server.
If edge nodes cannot handle additional workload, tasks are redirected to the fog node.
Each building node simulates several environmental and activity sensors.
| Sensor | Description |
|---|---|
| People | Number of occupants in the building |
| Temperature | Indoor temperature level |
| Humidity | Air moisture level |
| CO₂ | Air quality level |
| Motion | Activity detection level |
| Power | Device energy consumption |
The sensors dynamically influence one another.
Examples:
- Increasing people increases temperature, humidity, and CO₂
- Higher motion increases power consumption
- Increased power consumption raises temperature
These interactions simulate real smart building behaviour.
Nodes can operate in several states.
| Status | Meaning |
|---|---|
| ACTIVE | Normal operation |
| MAX-REACHED | A sensor has reached its maximum threshold |
| BALANCING-SEND | Node sending workload to another node |
| RECEIVING | Node receiving workload from another node |
| FOG-RECEIVING | Fog server receiving excess workload |
The monitoring service continuously evaluates node performance using metrics such as:
- CPU usage
- Memory usage
- Queue length
- Sensor activity
When imbalance occurs:
- The node with highest load becomes the sender
- Nodes with lower load become receivers
- Processing tasks are redistributed
If all edge nodes are heavily loaded, the fog node receives the excess workload.
Follow these steps to run the system locally.
git clone https://github.com/ynqabasikeyi/iot-edge-load-balancing.git
cd iot-edge-load-balancingEnsure Docker and Docker Compose are installed.
Download Docker here:
https://www.docker.com/products/docker-desktop/
Run the following command:
docker-compose up --buildThis will start:
- Edge nodes
- Fog node
- Monitoring service
- Dashboard
Open your browser and go to:
http://localhost:7000The dashboard allows you to:
- Adjust sensor sliders
- Simulate building activity
- Monitor node metrics
- Observe load balancing events
Using the dashboard, you can simulate various distributed system scenarios.
- Increase CO₂ or temperature in the Library node.
- The node reaches its sensor threshold.
- The node status becomes MAX-REACHED.
- The monitoring service redistributes workload to another node.
- The receiving node displays RECEIVING status.
This demonstrates dynamic distributed load balancing.
- Python
- Flask
- Docker
- Docker Compose
- HTML / JavaScript Dashboard
This system demonstrates important Distributed Systems concepts, including:
- Edge Computing
- Fog Computing
- Distributed Monitoring
- Load Balancing
- Sensor-Driven Processing
- Performance Transparency
- Fault-Tolerant Architecture
The project acts as a simulation platform for studying distributed resource management and adaptive workload balancing.
Possible future improvements include:
- Machine learning based workload prediction
- Advanced anomaly detection
- Real IoT device integration
- Decentralized monitoring architecture
- Kubernetes deployment
