- Project Overview
- System Architecture
- How It Works
- Technologies Used
- Installation & Execution
- Network Configuration
- Scalability & Multi-Workers
- Future Improvements
- Contact
Distributed CPU Monte Carlo Traffic is a high-performance Grid Computing platform designed to distribute CPU-intensive Monte Carlo simulations across multiple machines (Workers) managed by a central Master node.
- Leverage distributed CPU power across multiple nodes
- Execute simulations in parallel for faster computation
- Aggregate results efficiently with minimal overhead
- Provide a modern user interface using Next.js for visualization
- Support dynamic worker scaling for on-demand computation
graph TB
subgraph "Frontend Layer"
F[Next.js Client]
end
subgraph "Coordination Layer"
R[RMI Registry]
end
subgraph "Control Layer"
M[Master Node]
end
subgraph "Computation Layer"
W1[Worker Node 1]
W2[Worker Node 2]
W3[Worker Node N...]
end
F -->|Start Simulation| M
R -->|Service Discovery| M
R -->|Service Registration| W1
R -->|Service Registration| W2
R -->|Service Registration| W3
M -->|Distribute Tasks| W1
M -->|Distribute Tasks| W2
M -->|Distribute Tasks| W3
W1 -->|Return Results| M
W2 -->|Return Results| M
W3 -->|Return Results| M
M -->|Aggregate & Display| F
| Component | Role | Description |
|---|---|---|
| RMI Registry | Service Discovery | Central registry for coordinating nodes |
| Master Node | Task Manager | Splits simulations, assigns tasks, aggregates results |
| Worker Nodes | Computation Units | Perform CPU-intensive calculations |
| Client/Frontend | User Interface | Next.js app for simulation control and visualization |
sequenceDiagram
participant C as Client
participant R as RMI Registry
participant M as Master
participant W1 as Worker 1
participant W2 as Worker 2
Note over R: 1. Start RMI Registry
Note over M: 2. Master registers with Registry
Note over W1,W2: 3. Workers register with Registry
C->>M: 4. Launch Simulation
M->>M: 5. Split into Tasks
M->>W1: 6. Assign Task 1
M->>W2: 7. Assign Task 2
par Parallel Execution
W1->>W1: Compute Task 1
W2->>W2: Compute Task 2
end
W1->>M: 8. Return Results
W2->>M: 9. Return Results
M->>M: 10. Aggregate Results
M->>C: 11. Display Final Results
- Asynchronous execution - Workers process tasks independently
- Dynamic scaling - Workers can join/leave during execution
- Fault tolerance - System continues if workers disconnect
- Load balancing - Tasks distributed based on worker availability
git clone https://github.com/ZakariaHanani/distributed-cpu-montecarlo-traffic.git
cd distributed-cpu-montecarlo-trafficmvn clean install./scripts/run-registry.shOutput: โ
RMI Registry started on port 1099
./scripts/run-master.shOutput: โ
Master registered successfully
Edit scripts/run-worker.sh:
WORKER_IP=192.168.1.10 # Replace with your machine IPStart the worker:
./scripts/run-worker.shOutput: โ
Worker registered: [email protected]
./scripts/run-client.shcd frontend
npm run devVisit: http://localhost:3000
Each worker must:
- Use its local machine IP (not localhost)
- Be reachable over the network
- Have appropriate firewall rules
The Master and Registry can load network settings from:
# config.properties
registry.host=192.168.1.1
registry.port=1099
master.host=192.168.1.2
worker.pool.size=10Benefits:
- Single configuration file
- No code changes for network adjustments
- Easy deployment across environments
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Master Node โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ Task Queue โ โ
โ โ โข Task 1 โโโโโโโบ Worker 1 โ โ
โ โ โข Task 2 โโโโโโโบ Worker 2 โ โ
โ โ โข Task 3 โโโโโโโบ Worker 3 โ โ
โ โ โข Task 4 โโโโโโโบ Worker 4 โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
| Workers | Speed Increase | Use Case |
|---|---|---|
| 1 Worker | 1x Baseline | Development |
| 4 Workers | ~3.8x Faster | Small cluster |
| 10 Workers | ~9.5x Faster | Medium cluster |
| 50+ Workers | Linear Scaling | Cloud deployment |
Formula: Speedup โ N / (1 + (N-1)*f) where f is parallelizable fraction
- โ Dynamic worker joining/leaving
- โ Automatic task redistribution
- โ Load balancing
- โ Fault tolerance
- โ Minimal coordination overhead
- Branch Naming:
feature/,fix/,docs/,refactor/ - Commit Messages: Use conventional commits
- Code Reviews: All PRs require review
- Testing: Distributed testing across multiple machines
| Feature | Status | Expected |
|---|---|---|
| Automatic Worker Discovery | Planned | 2026 |
| Advanced Load Balancing | Planned | 2026 |
| Fault Tolerance & Health Monitoring | Research | 2026 |
| Real-time Dashboard | Planned | 2026 |
| Docker/Kubernetes Deployment | Planned | 2026 |
| GPU Acceleration Support | Research | 2026 |
- Machine Learning for optimal task distribution
- Blockchain for worker verification and trust
- Edge Computing integration for IoT devices
- Quantum Computing readiness
๐จโ๐ป Zakaria HANANI
| Platform | Link |
|---|---|
| GitHub | github.com/ZakariaHanani |
| [email protected] | |
| linkedin.com/in/zakaria-hanani |
๐จโ๐ป Mohamed OUIJJANE
| Platform | Link |
|---|---|
| GitHub | github.com/MohamedOuijjane |
| [email protected] | |
| [linkedin.com/in/mohamedouijjane |
๐จโ๐ป Ayoub Karkouri
| Platform | Link |
|---|---|
| GitHub | github.com/MohamedOuijjane |
| [email protected] | |
| linkedin.com/in/ayoubkarkouri |
๐จโ๐ป Ahmed LAHMAINE
| Platform | Link |
|---|---|
| GitHub | github.com/ahmed-la14 |
| [email protected] |
๐จโ๐ป Ali HALLA
| Platform | Link |
|---|---|
| GitHub | github.com/Alihalla |
| [email protected] |
๐จโ๐ป Hmad AIT LAHMOUSS
| Platform | Link |
|---|---|
| GitHub | github.com/hmad-ait-lahmous |
| [email protected] |
๐จโ๐ป Mohamed OUADRA
| Platform | Link |
|---|---|
| GitHub | github.com/MohamedOuadra |
| [email protected] |
We welcome contributions! Please:
- Fork the repository
- Create a feature branch
- Submit a Pull Request
- Join our discussions
# 1. Clone & Build
git clone https://github.com/ZakariaHanani/distributed-cpu-montecarlo-traffic && cd repo
mvn clean install
# 2. Start Services (in separate terminals)
./scripts/run-registry.sh
./scripts/run-master.sh
./scripts/run-worker.sh # Repeat for each worker
# 3. Launch Interface
cd frontend && npm run dev
# 4. Open browser: http://localhost:3000ยฉ 2025 โ Distributed CPU Monte Carlo Traffic
Grid Computing โข Java RMI โข High-Performance Computing
"Harnessing distributed power for complex simulations"
Tags: grid-computing monte-carlo java-rmi distributed-systems nextjs high-performance parallel-computing simulation