Commit e1a4767
Release v0.9.0: Worker Autoscaling and Enhanced Worker Pool Management
This release introduces comprehensive worker autoscaling capabilities that automatically
adjust worker pool sizes based on queue demand, significantly improving resource efficiency
and operational management.
## Worker Autoscaling Features
### Core Autoscaling Components
- AutoscaleConfig with comprehensive configuration options and sane defaults
- Three preset configurations: conservative(), aggressive(), and disabled()
- Dynamic scaling based on queue depth per worker metrics
- Configurable min/max worker limits, scaling thresholds, and cooldown periods
- AutoscaleMetrics for real-time monitoring of scaling decisions and utilization
### Smart Scaling Logic
- Background autoscaling task with configurable evaluation windows and scaling steps
- Queue depth averaging over time windows for stable decision making
- Graceful scaling with proper cooldown periods to prevent thrashing
- Respect for min/max worker boundaries and configurable scaling steps
### Enhanced WorkerPool
- Added with_autoscaling() and without_autoscaling() configuration methods
- Worker template system for creating new workers during scale-up operations
- Improved worker lifecycle management with proper shutdown handling
- Enhanced metrics collection and monitoring integration
## Implementation Details
### Configuration Defaults
- Enabled by default with conservative 1-10 worker range
- 60-second cooldown periods to prevent rapid oscillations
- 30-second evaluation windows for responsive but stable scaling
- Scale up at 5 jobs/worker, scale down at 2 jobs/worker
### Testing and Examples
- Comprehensive test suite covering all scaling scenarios and edge cases
- Complete autoscaling_example.rs demonstrating various configurations
- Type safety and proper error handling throughout
- Integration with existing statistics and monitoring systems
### Code Quality
- Full clippy compliance and code formatting
- Type aliases for complex types to improve readability
- Proper resource cleanup and graceful shutdown handling
- Backward compatibility maintained for existing WorkerPool usage
This feature significantly enhances hammerwork's production readiness by automatically
optimizing resource usage based on actual workload demand while maintaining system
stability and preventing resource waste.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <[email protected]>1 parent 7108318 commit e1a4767
File tree
17 files changed
+1350
-298
lines changed- examples
- src
- bin
- migrations
- queue
- tests
17 files changed
+1350
-298
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
8 | 30 | | |
9 | 31 | | |
10 | 32 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
32 | | - | |
| 32 | + | |
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
62 | 62 | | |
63 | 63 | | |
64 | 64 | | |
65 | | - | |
66 | | - | |
67 | | - | |
68 | | - | |
69 | | - | |
70 | | - | |
71 | | - | |
72 | | - | |
73 | | - | |
74 | | - | |
75 | | - | |
76 | | - | |
77 | | - | |
78 | | - | |
79 | | - | |
80 | | - | |
81 | | - | |
82 | | - | |
83 | 65 | | |
84 | 66 | | |
85 | 67 | | |
| |||
270 | 252 | | |
271 | 253 | | |
272 | 254 | | |
273 | | - | |
274 | | - | |
| 255 | + | |
275 | 256 | | |
276 | 257 | | |
277 | 258 | | |
| |||
0 commit comments