- Newest
- Most votes
- Most comments
Thank you for sharing your approach to testing Horizontal Pod Autoscaler (HPA) in EKS. Your method of using k6 as a load testing tool is indeed more sophisticated than the simple wget loop approach commonly found in tutorials.
The Horizontal Pod Autoscaler is a powerful Kubernetes feature that automatically adjusts the number of pod replicas based on observed metrics (typically CPU utilization, but it can use other metrics as well). It's designed to help applications handle fluctuating traffic without manual intervention.
Your approach of creating a basic Django app with a built-in stress command that can be targeted with k6 is a great way to test HPA functionality in a controlled environment. This provides several advantages over the simple wget loop:
- More realistic load patterns: k6 can generate various types of load patterns that better simulate real-world traffic
- Better metrics and reporting: k6 provides detailed performance metrics
- Controlled scaling: You can gradually increase load to observe exactly when HPA triggers
- More representative of real applications: Testing with Django is closer to actual production workloads than a simple PHP server
When testing HPA, it's important to observe:
- How quickly it scales up when load increases
- Whether it correctly scales to the appropriate number of replicas based on your target CPU utilization
- How it behaves when load decreases (noting that scale-down typically has a 5-minute default delay)
- How the scaling affects your application's performance
Your GitHub repository with a complete example will certainly be valuable to others looking to understand HPA behavior in a more controlled and realistic testing environment.
One thing to keep in mind is that HPA can work with different metrics sources beyond just CPU, including custom metrics and external metrics, which could be interesting to explore in future iterations of your testing approach.
Sources
Scale pod deployments with Horizontal Pod Autoscaler - Amazon EKS
Workload scaling - AWS Prescriptive Guidance
Running highly-available applications - Amazon EKS
Relevant content
asked 3 years ago
asked 2 years ago
