Cloud-native Performance Testing: Operating Locust and k6
Performance validation in distributed environments must include environment differences, observability, and reproducible results as well as load generation.
Performance Testing Approach
Section titled “Performance Testing Approach”Why performance test
Section titled “Why performance test”Performance testing evaluates how a system or application behaves under expected workloads. It’s a critical way to validate stability, scalability, responsiveness, and resource usage.
- Identify bottlenecks: find the parts of the system that degrade performance.
- Capacity planning: forecast resource requirements to handle growing users or data volume.
- Confirm stability: validate system stability under long-running or high-load conditions.
- Test scalability: assess how the system responds to increasing load.
- Establish performance baselines: set benchmarks for future comparison.
- Optimize infrastructure: gather metrics to tune hardware and software configuration.
Types of Performance Tests
Section titled “Types of Performance Tests”A system has to run countless tasks concurrently and respond to many different requests from many different users. Different traffic patterns create different risk profiles for an application, so thorough preparation calls for a range of test types.

Smoke Test
An initial test to quickly confirm that a system’s basic functionality and performance work as expected. It checks the system responds under minimal load, verifies the system is in a fit state before running a full Performance Test, and is used for a quick check right after deployment.

Average-load Test
Evaluates how the system performs under typical load. It simulates the concurrent users and request rates seen in production, analyzing response time and resource usage under everyday usage patterns and confirming whether SLAs are being met.

Stress Test
Evaluates how the system performs when load is heavier than usual. The load pattern resembles the average-load test but applies more of it, validating the system’s failure points, error handling/recovery under overload, data integrity at max load, and graceful degradation.

Soak Test
Applies sustained load over a long period to validate the system’s stability and reliability. It surfaces long-term issues like memory leaks and connection leaks, performance degradation over long operation, gradually increasing resource usage patterns, and the impact of background tasks like backups and cleanup.

Spike Test
Confirms the system works correctly when it suddenly faces a massive spike in user traffic (ticket sales, product launches, seasonal sales events, and the like). Load ramps up extremely quickly to a very high level, with a short plateau and ramp-down. It validates the system’s reaction to a traffic surge, the effectiveness of auto-scaling, recovery ability after a sudden load change, and buffer overflow/queue backlog issues.

Breakpoint Test
Aims to find the system’s limits, understanding where and how it breaks so you can prepare for it. Load is increased gradually to find the point where performance starts to degrade, giving you accurate thresholds and capacity-planning data for a scaling strategy.

Cloud-native performance testing considerations from the CDS role
Section titled “Cloud-native performance testing considerations from the CDS role”Elastic scalability testing: verifies that auto-scaling in the cloud environment works effectively. This covers the trigger thresholds for horizontal/vertical scaling, how long a scaling action takes, the effectiveness of different scaling policies (CPU/memory/request-based), and service continuity during scale-out/scale-in.
Cost-based performance optimization: analyzes infra cost against traffic and simulates cost under different autoscaling limits.
Microservice architecture performance testing: validates inter-service communication latency, bottlenecks in a service chain, service mesh overhead, and the consistency and performance of distributed transactions.
Container resource limit testing: validates performance changes under CPU/memory limits, the scheduling impact of container orchestration, service downtime during restarts/migrations, and behavior under resource contention.
Resilience testing for infrastructure changes: tests stability under node failure/network partitions, automatic recovery mechanisms, service continuity during infra changes, and failure response in multi-region/multi-zone setups.
Other considerations
Section titled “Other considerations”- Implementing performance observability: unified collection and analysis of metrics/logs/traces, tracing request flow via distributed tracing, performance anomaly detection/alerting, real-time dashboard-based monitoring
- Data storage performance testing: optimizing DB query performance, the effectiveness of caching strategies, comparing NoSQL vs. relational DB performance characteristics, forecasting performance as data volume grows
- Network performance and constraint testing: behavior under latency/packet loss/bandwidth limits, the performance impact of CDNs/load balancers, regional performance differences in a globally distributed setup, the performance impact of network policies (security groups)
- Balancing security and performance: SSL/TLS encryption, authentication/authorization mechanisms, the latency impact of API gateways/WAFs, the performance impact of security scanning/audit logging
- Automated performance testing in the CI/CD pipeline: automatically assessing the performance impact of code changes, catching performance regressions early, automated comparison against a performance baseline, automating deploy approve/reject decisions based on test results
Reference: cloud-native test tools: Locust vs. k6
Section titled “Reference: cloud-native test tools: Locust vs. k6”Locust and k6 are both widely used open-source tools for load and performance testing web applications. Both are strong on automation, scalability, and customization, but differ in language, architecture, and usability.
| Item | Locust | k6 |
|---|---|---|
| Scripting language | Python | JavaScript |
| Architecture | Supports a distributed Master-Worker setup | Single process, uses multiple cores |
| Execution environment | Can distribute load across multiple nodes | Runs efficiently on a single machine |
| Scripting style | Imperative, class/method-based | Declarative, function-based |
| Real-time monitoring | Built-in web UI (browser-based) | Console output, can integrate with InfluxDB + Grafana |
| Extensibility | Custom reporting, broad external integrations | Extend via JS modules, supports various output formats |
Locust scenarios are written in Python and fit well for large-scale load testing across a distributed environment. Its built-in web UI shows progress and results visually in real time, and it integrates well with external systems like Jenkins, Slack, and Grafana.
k6 scripts are written in JavaScript and give you fast, efficient load testing on a single machine. It supports console-based real-time monitoring and dashboard visualization through InfluxDB+Grafana, and its code-first approach makes it easy to slot into a CI/CD pipeline.
Reference: a Locust test example
Section titled “Reference: a Locust test example”Key takeaways from the test results:
- Users need to ramp up gradually: pushing too many users too quickly, before each service’s Pods had scaled to their minimum count, caused Response Timeouts (15s). We ramped 100 users at 10 users/second up to a maximum of 4,000 users.
- Initial application resource requests were set too low: some applications’ initial memory request was around 20Mi, causing frequent OOM kills. We bumped it to 100Mi and applied HPA to adapt to load dynamically.
- AKS (Kubernetes) node scaling: when Pods scaled up under load, they could hit a node ceiling and go Pending; the automatic node-scaling event fires, but with some delay, causing Response Timeouts until nodes scale up. We seeded the initial node count at 2–3 for early tests and split the load generator (Locust Worker) onto a separate node.

Reference: a k6 test example
Section titled “Reference: a k6 test example”Local environment
After writing the test script, we ran it locally and checked the logs. Test results are exported as Prometheus metrics and pushed to a self-managed metrics store.

CI/CD integration
Test scripts are version-controlled in Git and run by the pipeline before CI/CD executes. Test logs are viewed through the CI/CD tool, and results are stored as metrics.

Scheduled tests (Kubernetes CronJob)
Test scripts and configuration are deployed to the k8s cluster as a resource called TestRun, provided by k6. A Kubernetes CronJob runs it periodically; the Pod the CronJob creates runs the test script and pushes logs and result metrics.

Summary
Section titled “Summary”This article covered Performance Test goals, tool selection, and execution examples. Next, examine the backup/recovery boundary across Cloud and Kubernetes resources.
Series order
Section titled “Series order”Previous: Operating Kubernetes Utilities: GitOps-based Add-on Management
Next: Cloud and Kubernetes Backup & Recovery: Azure Backup and Velero