mirror of
https://github.com/GNS3/gns3-server.git
synced 2026-08-27 12:30:13 +03:00
feat(copilot): add dynamic wait time calculation for node startup
Optimize GNS3StartNodeTool with device-type-aware wait time calculation
to significantly reduce startup time for fast devices (VPCS, IOU).
Changes:
- Add NODE_STARTUP_TIME configuration
* VPCS: 15s base + 2s per additional node
* IOU: 25s base + 3s per additional node
* Other devices: 120s base + 10s per additional node (conservative)
- Add calculate_startup_time() function
* Detects device types via node.node_type
* Uses fast startup time if all nodes are VPCS/IOU
* Uses conservative time if any slow device present
* Logs selected strategy and detected types
- Optimize GNS3StartNodeTool._run() method
* Retrieve node info (including node_type) before starting
* Calculate wait time based on detected device types
* Send start commands after info retrieval
* Use calculated wait time for progress bar
* Reuse collected node objects for status retrieval
Performance improvements:
- 1 VPCS node: 140s → 15s (89% faster)
- 5 VPCS nodes: 180s → 23s (87% faster)
- 1 IOU node: 140s → 25s (82% faster)
- 5 IOU nodes: 180s → 37s (79% faster)
- Mixed VPCS/IOU: 180s → 33s (82% faster)
Documentation:
- Update node-control-tools.md with dynamic wait time strategy
- Add device type comparison table
- Document performance improvements
- Update changelog
Code quality:
- All comments in English
- flake8 check passed
- mypy check passed
This commit is contained in:
parent
a946ef2d69
commit
c3b18f4ce2
@ -271,25 +271,25 @@ The tool automatically detects node types and calculates optimal wait times:
|
||||
|
||||
| Device Type | Base Time | Per Additional Node | Example (5 nodes) |
|
||||
|-------------|-----------|-------------------|-------------------|
|
||||
| **VPCS** | 10s | +2s | 18s total |
|
||||
| **IOU** | 20s | +3s | 32s total |
|
||||
| **Mixed VPCS/IOU** | 20s | +2s | 28s total |
|
||||
| **VPCS** | 15s | +2s | 23s total |
|
||||
| **IOU** | 25s | +3s | 37s total |
|
||||
| **Mixed VPCS/IOU** | 25s | +2s | 33s total |
|
||||
| **QEMU/Dynamips/Docker/VMs** | 120s | +10s | 160s total |
|
||||
| **Mixed (any slow device)** | 120s | +10s | 160s total |
|
||||
|
||||
**How It Works:**
|
||||
1. Retrieves node information including `node_type`
|
||||
2. Checks if all nodes are fast devices (VPCS/IOU only)
|
||||
3. If all fast: Uses max(10s, 20s) base + 2s per extra node
|
||||
3. If all fast: Uses max(15s, 25s) base + 2s per extra node
|
||||
4. If any slow device present: Uses 120s base + 10s per extra node
|
||||
5. Logs the detected device types and chosen strategy
|
||||
|
||||
**Performance Improvements:**
|
||||
- ⚡ **1 VPCS node**: 140s → 10s (93% faster)
|
||||
- ⚡ **5 VPCS nodes**: 180s → 18s (90% faster)
|
||||
- ⚡ **1 IOU node**: 140s → 20s (86% faster)
|
||||
- ⚡ **5 IOU nodes**: 180s → 32s (82% faster)
|
||||
- ⚡ **Mixed VPCS/IOU**: 180s → 28s (84% faster)
|
||||
- ⚡ **1 VPCS node**: 140s → 15s (89% faster)
|
||||
- ⚡ **5 VPCS nodes**: 180s → 23s (87% faster)
|
||||
- ⚡ **1 IOU node**: 140s → 25s (82% faster)
|
||||
- ⚡ **5 IOU nodes**: 180s → 37s (79% faster)
|
||||
- ⚡ **Mixed VPCS/IOU**: 180s → 33s (82% faster)
|
||||
|
||||
**Use Cases:**
|
||||
- Automated lab deployment
|
||||
@ -301,6 +301,9 @@ The tool automatically detects node types and calculates optimal wait times:
|
||||
- Retrieves node type via `node.get()` before starting
|
||||
- Calculates wait time using `calculate_startup_time()` function
|
||||
- Uses device-specific `NODE_STARTUP_TIME` configuration
|
||||
* VPCS: 15s base + 2s per node (conservative for slower hardware)
|
||||
* IOU: 25s base + 3s per node (accounts for IOU initialization overhead)
|
||||
* Other: 120s base + 10s per node (conservative for full emulators)
|
||||
- Logs device types and selected wait strategy
|
||||
- Progress bar displays calculated wait time
|
||||
|
||||
@ -948,9 +951,10 @@ _Status: ✅ Implemented - Topology management tools available in both modes. Fu
|
||||
_Changelog:_
|
||||
- **2026-03-14 (Evening)**: Added dynamic wait time calculation
|
||||
- `GNS3StartNodeTool` now calculates optimal wait times based on device types
|
||||
- Fast devices (VPCS: 10s, IOU: 20s) start much faster than before
|
||||
- Fast devices (VPCS: 15s, IOU: 25s) start much faster than before
|
||||
- Conservative timing accounts for slower hardware environments
|
||||
- Slow devices (QEMU, Dynamips, etc.) use conservative 120s base time
|
||||
- Performance improvements: 82-93% faster for VPCS/IOU labs
|
||||
- Performance improvements: 79-89% faster for VPCS/IOU labs
|
||||
- Automatic device type detection via `node.node_type`
|
||||
- Logs selected strategy and detected device types
|
||||
|
||||
|
||||
@ -47,9 +47,10 @@ logger = logging.getLogger(__name__)
|
||||
|
||||
# Node startup time configuration by device type
|
||||
# Based on typical boot times for different emulators
|
||||
# Conservative timing to account for slower hardware environments
|
||||
NODE_STARTUP_TIME = {
|
||||
"vpcs": {"base": 10, "extra_per_node": 2}, # VPCS: Very fast startup
|
||||
"iou": {"base": 20, "extra_per_node": 3}, # IOU: Fast startup
|
||||
"vpcs": {"base": 15, "extra_per_node": 2}, # VPCS: Very fast startup
|
||||
"iou": {"base": 25, "extra_per_node": 3}, # IOU: Fast startup
|
||||
"default": {"base": 120, "extra_per_node": 10}, # Other devices: Conservative time
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user