A robust framework for optimizing resource management in complex microservice deployments with shared services and multi-chain dependencies. DTA-SLO leverages real-time traffic monitoring, time-series prediction using GRU (Gated Recurrent Unit), and novel optimization approaches to dynamically allocate resources based on individual service chain SLOs.
git clone https://github.com/ahmadpanah/dta-slo.git
cd dta-slo
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
pip install -r requirements.txt
docker-compose up --build
docker build -t dta-slo .
docker run -d --name dta-slo -v ~/.kube:/home/appuser/.kube:ro -p 8000:8000 dta-slo
config/config.yaml
:
```yaml
services:
auth-service:
chains:
slos: user-registration: 0.2 # 200ms order-processing: 0.5 # 500ms
2. Run the framework:
```bash
python main.py
dta_slo/
│
├── __init__.py
├── requirements.txt
├── config/
│ └── config.yaml
│
├── src/
│ ├── __init__.py
│ ├── models/
│ │ ├── data_models.py
│ │ └── metrics.py
│ │
│ ├── components/
│ │ ├── traffic_monitor.py
│ │ ├── traffic_predictor.py
│ │ ├── performance_quantifier.py
│ │ └── resource_allocator.py
│ │
│ └── utils/
│ └── kubernetes_utils.py
│
└── main.py
Collects and processes real-time service metrics:
traffic_monitor = TrafficMonitor(sampling_interval=1.0)
traffic_monitor.record_request("auth-service", "user-registration", 0.15)
Forecasts future traffic patterns using GRU:
predictor = TrafficPredictor(sequence_length=60, prediction_horizon=10)
future_load = predictor.predict(historical_data)
Optimizes resource allocation based on traffic and SLOs:
allocator = DynamicResourceAllocator(traffic_monitor, traffic_predictor, performance_quantifier)
new_allocations = allocator.optimize_resources(services, slos)
DTA-SLO tracks several key metrics:
monitoring:
sampling_interval: 1.0 # seconds
window_size: 3600 # seconds
prediction:
sequence_length: 60
prediction_horizon: 10
feature_dim: 3
git checkout -b feature/amazing-feature
)git commit -m 'Add amazing feature'
)git push origin feature/amazing-feature
)This project is licensed under the MIT License - see the LICENSE file for details.