v0.1.30 - CPU Auto-Detection for Small VPS
π CPU Auto-Detection for Small VPS
This release adds intelligent CPU detection to prevent overload on small VPS instances.
π§ Key Changes
CPU Auto-Detection
- Automatically detects CPU cores and adjusts worker threads accordingly
- 1-2 cores β 1 worker thread (small VPS)
- 3-4 cores β 2 worker threads (medium system)
- 5+ cores β 4 worker threads (large system)
Concurrent Batch Optimization
- Auto-detects optimal concurrent API batch requests
- 1-2 cores β 1 concurrent batch (sequential processing)
- 3-4 cores β 2 concurrent batches
- 5+ cores β 3 concurrent batches
Cache Frequency Adjustment
- Reduced auto-reload frequency from 15s to 30s
- Better balance between freshness and CPU efficiency
Startup Logging
- Added detailed CPU configuration logging at startup
- Shows detected cores, worker threads, and concurrent batches
π Expected Impact on 2-Core VPS
Before:
- Worker threads: 8 (400% oversubscription)
- Concurrent batches: 3 per worker
- Auto-reload: Every 15s
- CPU usage: 100% constantly
After:
- Worker threads: 1 (optimal for 2 cores)
- Concurrent batches: 1 (sequential)
- Auto-reload: Every 30s
- CPU usage: 30-50% during sync periods, near 0% when idle
π Technical Details
- Added
num_cpusdependency for CPU detection - Updated all workers (daily, slow, crypto) to use auto-detected configurations
- Changed default
concurrent_batchesfrom 3 β 1 (conservative fallback)
π Files Modified
Cargo.toml: Add num_cpus dependencysrc/utils.rs: Add CPU detection helperssrc/commands/serve.rs: Use auto-detected configuration + detailed loggingsrc/commands/pull.rs: Use auto-detected concurrent batchessrc/services/data_store.rs: CACHE_TTL_SECONDS 15s β 30ssrc/models/sync_config.rs: Default concurrent_batches 3 β 1src/worker/*.rs: Use auto-detected concurrent batches
π Deployment
The optimizations work automatically - no configuration needed. Check startup logs for detected configuration:
```
π§ CPU Configuration (auto-detected):
π» CPU cores detected: 2
π§ Worker threads: 1
β‘ Concurrent batches: 1
```
Full Changelog: v0.1.29...v0.1.30