Last Updated: 03 January 2026
Status: 🟢 Current
Related: Security | Observability | Runtime Modes | Architecture | INDEX
This guide covers best practices for deploying and operating OrKa in production environments, focusing on performance, reliability, and maintainability.
graph TD
A[Client Applications] --> B[Load Balancer]
B --> C1[OrKa API 1]
B --> C2[OrKa API 2]
B --> C3[OrKa API 3]
C1 --> D[RedisStack Cluster]
C2 --> D
C3 --> D
C1 --> E[RedisStack Cluster]
C2 --> E
C3 --> E
D --> F[Monitoring]
E --> F
-
High Availability
- Deploy multiple OrKa instances
- Use load balancers for distribution
- Implement proper health checks
- Set up automatic failover
-
Scalability
- Horizontal scaling for API servers
- RedisStack cluster for memory
- RedisStack for memory and vector search
- Separate compute and storage
-
Reliability
- Circuit breakers for external services
- Retry mechanisms with backoff
- Graceful degradation strategies
- Comprehensive error handling
-
HNSW Configuration
memory_config: enable_hnsw: true vector_params: M: 16 # Balance between speed and accuracy ef_construction: 200 # Higher = better index, slower builds ef_runtime: 10 # Higher = better search, more CPU
-
Memory Settings
# redis.conf maxmemory 8gb maxmemory-policy allkeys-lru save 900 1 save 300 10 save 60 10000 -
Connection Pooling
memory_config: pool_size: 20 pool_timeout: 30 retry_on_timeout: true
-
Parallel Processing
orchestrator: strategy: parallel max_concurrent: 50 batch_size: 10
-
Resource Limits
agents: - id: heavy_processor type: openai-answer resources: memory_limit: 1G cpu_limit: 2
memory_config:
decay:
enabled: true
default_short_term_hours: 2
default_long_term_hours: 168
check_interval_minutes: 30
# Importance rules
importance_rules:
user_correction: 3.0
positive_feedback: 2.0
successful_answer: 1.5
routine_query: 0.8memory_config:
namespaces:
user_data:
retention_days: 30
backup_enabled: true
system_logs:
retention_days: 7
compression: true
analytics:
retention_days: 90
aggregation: true# Automated backup script
#!/bin/bash
DATE=$(date +%Y%m%d)
redis-cli SAVE
tar czf backup_$DATE.tar.gz dump.rdb
aws s3 cp backup_$DATE.tar.gz s3://backups/security_config:
auth:
type: jwt
issuer: orka-auth
audience: orka-api
expiry: 1hapi_config:
rate_limit:
requests: 1000
per_minute: true
cors:
allowed_origins: ["https://app.example.com"]
allowed_methods: ["GET", "POST"]security_config:
encryption:
at_rest: true
in_transit: true
key_rotation: 30dmonitoring_config:
metrics:
enabled: true
interval: 15s
exporters:
- prometheus
- datadog-
System Health
- CPU usage
- Memory utilization
- Disk I/O
- Network traffic
-
Application Metrics
- Request latency
- Error rates
- Queue depth
- Active workflows
-
Memory Metrics
- Vector search latency
- Index size
- Cache hit rate
- Memory fragmentation
alerts_config:
rules:
- name: high_latency
condition: latency > 500ms
duration: 5m
severity: warning
- name: error_spike
condition: error_rate > 5%
duration: 1m
severity: criticalversion: '3.8'
services:
redis-stack:
image: redis/redis-stack:latest
command: redis-stack-server --save 60 1000
volumes:
- redis_data:/data
deploy:
resources:
limits:
memory: 8G
reservations:
memory: 4G
orka:
image: marcosomma/orka:latest
environment:
- REDIS_URL=redis://redis-stack:6380/0
- ORKA_MEMORY_BACKEND=redisstack
- ORKA_MAX_CONCURRENT_REQUESTS=100
deploy:
replicas: 3
update_config:
parallelism: 1
delay: 10s
resources:
limits:
memory: 2G
cpus: '2'
monitoring:
image: marcosomma/orka-monitor:latest
ports:
- "9090:9090"
volumes:
- monitoring_data:/dataapiVersion: apps/v1
kind: Deployment
metadata:
name: orka-api
spec:
replicas: 3
template:
spec:
containers:
- name: orka
image: marcosomma/orka:latest
resources:
requests:
memory: "1Gi"
cpu: "500m"
limits:
memory: "2Gi"
cpu: "2"
readinessProbe:
httpGet:
path: /health
port: 8000
livenessProbe:
httpGet:
path: /health
port: 8000-
Index Optimization
# Schedule during low traffic redis-cli FT.OPTIMIZE orka:mem:idx -
Memory Cleanup
# Regular cleanup orka memory cleanup --dry-run orka memory cleanup -
Backup Verification
# Weekly backup test orka backup verify
-
Add RedisStack Node
# 1. Start new node docker run -d redis/redis-stack # 2. Add to cluster redis-cli CLUSTER MEET # 3. Rebalance redis-cli CLUSTER REBALANCE
-
Scale OrKa API
# Kubernetes kubectl scale deployment orka-api --replicas=5 # Docker Swarm docker service scale orka_api=5
orka/
├── api/ # API endpoints
├── core/ # Core logic
├── memory/ # Memory system
├── agents/ # AI agents
├── nodes/ # Workflow nodes
└── utils/ # Utilities
-
Unit Tests
# Run with coverage pytest --cov=orka tests/unit/ -
Integration Tests
# Test with real services pytest tests/integration/ -
Performance Tests
# Load testing locust -f tests/performance/locustfile.py
# Structured logging
logger.info("Memory operation completed", extra={
"operation": "vector_search",
"namespace": namespace,
"duration_ms": duration,
"results_count": len(results)
})try:
result = memory.search(query)
except RedisError as e:
logger.error("Redis search failed", exc_info=e)
# Fallback to basic search
result = memory.basic_search(query)
except Exception as e:
logger.critical("Unhandled error", exc_info=e)
raise- Prefer
params.structured_outputfor LLM agents to enforce JSON at generation time - Use
tool_callfor strict schema compliance;model_jsonfor lighter guarantees - For local models (Ollama/LM Studio), use
promptmode with concise instructions ← GraphScout | 📚 INDEX | Testing →