Files
DOLPHIN/prod/docs/LATENCY_OPTIONS.md

54 lines
1.7 KiB
Markdown
Raw Normal View History

# ExF Latency Options
## Current: 500ms Standard
- **HZ Push Interval**: 0.5 seconds
- **Latency**: Data in HZ within 500ms of change
- **CPU**: Minimal (~1%)
- **Use Case**: Standard 5-second Alpha Engine scans
## Option 1: 100ms Fast (5x faster)
- **HZ Push Interval**: 0.1 seconds
- **Latency**: Data in HZ within 100ms of change
- **CPU**: Low (~2-3%)
- **Use Case**: High-frequency Alpha Engine
- **Run**: `python exf_fetcher_flow_fast.py`
## Option 2: Event-Driven (Near-zero)
- **HZ Push**: Immediately on indicator change
- **Latency**: <10ms for critical indicators
- **CPU**: Minimal (only push on change)
- **Use Case**: Ultra-low-latency requirements
- **Run**: `python realtime_exf_service_hz_events.py`
## Recommendation
For your setup with 5-second Alpha Engine scans:
- **Standard (500ms)**: ✅ Sufficient - 10x oversampling
- **Fast (100ms)**: ⚡ Better - 50x oversampling, minimal overhead
- **Event-driven**: 🚀 Best - Near-zero latency, efficient
## Quick Start
```bash
cd /mnt/dolphinng5_predict/prod
# Option 1: Standard (current)
./start_exf.sh restart
# Option 2: Fast (100ms)
nohup python exf_fetcher_flow_fast.py --warmup 10 > /var/log/exf_fast.log 2>&1 &
# Option 3: Event-driven
nohup python realtime_exf_service_hz_events.py --warmup 10 > /var/log/exf_event.log 2>&1 &
```
## Data Freshness by Option
| Option | Max Latency | Use Case |
|--------|-------------|----------|
| Standard | 500ms | Normal operation |
| Fast | 100ms | HFT-style trading |
| Event-Driven | <10ms | Ultra-HFT, market making |
**Note**: The in-memory cache is updated every 0.5s for critical indicators regardless of HZ push rate. The push rate only affects how quickly data appears in Hazelcast.