Performance Optimization
API Performance Issues
If you experience slow response times or endless loops:
Check System Resources
# Monitor CPU and memory usage htop # Check GPU memory (if using GPU) nvidia-smiRun Performance Tests
# Test API performance python scripts/monitor_performance.pyOptimize Configuration
# Reduce batch sizes for memory-constrained systems export EMBEDDING_BATCH_SIZE=32 export MAX_CONTEXT_LENGTH=4096 # Use CPU-only mode if GPU memory is insufficient export DEVICE=cpuCommon Performance Issues
- Endless loops: Usually caused by LLM generation timeouts. Check your Ollama/Hugging Face connection.
- Slow searches: Vector database may need optimization. Consider rebuilding with smaller chunks.
- Memory issues: Reduce
MAX_SEARCH_RESULTSandMAX_CONTEXT_LENGTHin config.
Timeout Settings
- Embedding generation: 5 seconds
- Vector search: 10 seconds
- LLM generation: 30 seconds
- Query routing: 5 seconds
Performance Monitoring
The system includes built-in performance monitoring:
# Monitor real-time performance
python scripts/monitor_performance.py
# Check API health
curl http://localhost:8000/api/v1/health
# Test specific endpoints
curl -X POST http://localhost:8000/api/v1/search \
-H "Content-Type: application/json" \
-d '{"query": "CVE-2021-44228", "top_k": 5}'