Configuration
Complete configuration reference for the Autoscaler components.
Nomadscaler Plugin Configuration
Scaling Policy
scaling "horizontal" {
enabled = true
min = 1
max = 100
policy {
# Evaluation frequency
evaluation_interval = "10s"
# Minimum time between scaling actions
cooldown = "30s"
target "nomadscaler" {
# Nomad job details
namespace = "default"
job = "web-app"
group = "frontend"
# Optimizer service
optimizer_url = "http://optimizer:8000"
# Cache configuration
cache_size = 10 # seconds of predictions to cache
# Metrics source
metric_source = "nomad" # "nomad" or "prometheus"
}
check "cpu_utilization" {
source = "nomad-apm"
query = "avg_cpu_percent"
strategy "target-value" {
target = 75
}
}
check "memory_utilization" {
source = "nomad-apm"
query = "avg_memory_percent"
strategy "target-value" {
target = 80
}
}
}
}Configuration Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
namespace | string | Yes | - | Nomad namespace |
job | string | Yes | - | Job name |
group | string | Yes | - | Task group name |
optimizer_url | string | Yes | - | Optimizer service URL |
cache_size | int | No | 10 | Prediction cache size (seconds) |
metric_source | string | No | "nomad" | Metric source (nomad or prometheus) |
Optimizer Service Configuration
config.ini
[main]
loglevel=debug
api_loglevel=warning
only_test_data=true
enable_test_metrics=true
prometheus_url=http://localhost:9090
token=supersecrettokenConfiguration Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
loglevel | string | debug | Logging level (debug, info, warning, error) |
api_loglevel | string | warning | API/request logging level |
only_test_data | boolean | true | Use bundled test data instead of real metrics |
enable_test_metrics | boolean | true | Enable test metrics endpoint for development |
prometheus_url | string | http://localhost:9090 | Prometheus server URL for metrics retrieval |
token | string | - | API authentication token (treat as secret) |
Configuration Loading
The optimizer loads configuration from config.ini with the following resolution order:
- Path from
CONFIG_PATHenvironment variable (if set) <base_dir>/config.ini<base_dir>/../config.ini
Example:
# Override config path
export CONFIG_PATH=/path/to/custom/config.ini
# Run optimizer
poetry run webSARIMAX Model Selection
The optimizer automatically selects the best SARIMAX model from multiple candidate orders using AIC (Akaike Information Criterion). The candidates are:
(1, 1, 1)- Standard ARIMA with differencing(1, 0, 1)- ARMA without differencing (for stationary data)(2, 1, 1)- Higher-order AR component(1, 1, 0)- Pure AR model with differencing
The optimizer will fit all candidates and select the model with the lowest AIC.
MILP Solver Parameters
The MILP optimizer uses OR-Tools SCIP solver with the following default parameters:
- replica_cost: Based on allocated CPU/memory with configurable weights
- penalty: 1.0 (SLA violation cost)
- startup_cost: 0.5 (cost to start new instances)
- shutdown_cost: 0.3 (cost to stop instances)
- max_scale_up: 2 (maximum instances to start per time step)
- max_scale_down: 2 (maximum instances to stop per time step)
These parameters are hard-coded in the optimizer and tuned for general workloads. The capacity and replica costs are calculated dynamically based on allocated resources and the weights defined in weights.py.
Request Parameters
When calling the /optimize endpoint, you can configure:
cache_size
Number of seconds to predict ahead (default: 10):
{
"cache_size": 10
}Larger cache = more stable predictions, less frequent optimizer calls. Smaller cache = more responsive to changes.
min_replicas / max_replicas
Bounds for the optimization:
{
"min_replicas": 1,
"max_replicas": 10
}current_replicas
Current state for optimal transitions:
{
"current_replicas": 3
}Development Mode
Test Data Mode
For local development and testing:
[main]
only_test_data=true
enable_test_metrics=trueThis uses bundled test data instead of querying real Prometheus metrics.
Production Mode
[main]
only_test_data=false
enable_test_metrics=false
prometheus_url=http://prometheus:9090
token=PRODUCTION_SECRET_TOKEN