94 / 95 · 05 Performance & Chaos Engineering · Kubernetes Scaling and Container Performance Testing← prev⊞ allnext →☰ Read as one page
14.6Resource Limits and Performance
Kubernetes resource requests and limits directly affect performance. Under-provisioned containers throttle at the worst possible moment:
# resource-config-for-performance.yaml
resources:
requests:
cpu: 500m # guaranteed CPU allocation
memory: 512Mi # guaranteed memory allocation
limits:
cpu: 2000m # burst capacity (4x request)
memory: 1Gi # hard memory limit (OOMKill if exceeded)
Performance Testing Resource Configurations
Test your service under different resource configurations to find the optimal settings:
| Configuration | CPU Request/Limit | Memory Request/Limit | Test Result |
|---|---|---|---|
| Minimal | 100m/500m | 128Mi/256Mi | 50 req/s, p99=2.5s, OOMKill under load |
| Conservative | 250m/1000m | 256Mi/512Mi | 100 req/s, p99=800ms, stable |
| Optimal | 500m/2000m | 512Mi/1Gi | 200 req/s, p99=400ms, stable |
| Generous | 1000m/4000m | 1Gi/2Gi | 200 req/s, p99=350ms, diminishing returns |
The "optimal" configuration achieves target performance without wasting resources. Load testing is the only way to find this sweet spot.