NewWork mode: your Claude Code or Codex on work calls, answering from your project's codeSkip to content
Senior1 view

How would you organize load testing for the designed service: what baseline scenarios, signs of degradation, and Kubernetes container metrics should be monitored?

Practice

AI answer

First, I’d define the target SLAs/SLOs and load profile: expected concurrent users, request frequency, proportion of uploads, file sizes, context length, and LLM provider behavior. Testing should be done in an environment close to production, with realistic data and controlled limits on external dependencies.

Scenarios:

  • Baseline test: individual requests, document uploads, and processing.
  • Load test: gradually ramp up to the expected peak and sustain the load.
  • Spike test: briefly apply a load above the expected level to check limits and recovery.
  • Soak test: sustain a steady load for hours to identify leaks and queue buildup.
  • Failure test: introduce latency or unavailability in the LLM, vector database, queue, or pod; check timeouts, retries, and degraded behavior.
  • Separately test different file and request sizes, as well as concurrent uploads and chats.

Signs of degradation: rising p95/p99 latency and error/timeout rates, reduced throughput, growing queues and document processing times, exhausted connections or provider quotas, frequent restarts and OOMKilled events, and reduced retrieval quality after retrieval configuration changes. For generation, it is useful to measure time to first token and total response time separately.

Kubernetes and container metrics: CPU usage and throttling, memory and OOM events, restarts and readiness/liveness failures, replica count and scaling speed, network traffic and errors, disk space and I/O. At the cluster level, monitor node health, pending pods, and resource shortages. Application metrics include RPS, latency percentiles, errors by type, active requests, queue lengths, processing time, tokens, and cost. Correlate metrics with traces and structured logs to locate the bottleneck, rather than merely detect overload.