Right-Sizing Your ZoneHero Deployment
Before going to production with ZoneHero, it’s essential to perform a right-sizing exercise. This process is straightforward and relatively quick, but it’s a crucial step to ensure your system operates with high availability, optimal performance, and maximum cost efficiency.
Understanding the Need for Right-Sizing
Most applications exhibit predictable daily usage patterns. The goal of right-sizing is to determine which instance type you need to:
- Avoid wasting resources during low-traffic periods
- Maintain sufficient capacity during peak-traffic periods
Resource usage typically scales linearly with traffic. However, we cannot provide one-size-fits-all guidance on configuration based solely on volume, as this heavily depends on your specific setup and traffic composition.
The Right-Sizing Approach
As a general rule, you should identify an instance type that allows you to maintain 2 instances per Availability Zone during your least busy period, with each instance operating at your target CPU usage (default is 50%).
Example Scenario
Let’s consider a scenario where your peak hour traffic is twice the volume of your nighttime traffic, and your workload is distributed across 4 availability zones:
- Initial Configuration: You might start with the following launch_config and gradually migrate traffic to it:
launch_config {
instance_type = "c7g.2xlarge"
min_instance_count = 8
target_cpu_usage = 50
}
Observation Phase: After testing, you notice that during peak hours, your load balancers are only utilizing 25% of CPU capacity across 8 instances.
Optimization: Since you’re targeting 50% utilization but only reaching 25%, your instances are approximately four times larger than necessary. The calculation is:
- Each
c7g.2xlarge
has 8 vCPUs - At peak time you’re using 8x8x0.25=16 full vCPU-equivalent
- At night you will only need half of them, used at 50%: 16/2/0.50=16 vCPUs
- You want 8 instances at night, so you need instances with 2 vCPU (
c7g.large
)
- Each
Implementing Your Right-Sized Configuration
After determining the appropriate instance type, update your Terraform configuration with the optimized settings:
launch_config {
instance_type = "c7g.large" # Right-sized from c7g.2xlarge
min_instance_count = 8
target_cpu_usage = 50
}
Monitoring and Adjusting
After implementing your right-sized configuration, continue to monitor performance metrics. As your traffic patterns evolve, you may need to revisit your sizing decisions to maintain the optimal balance between performance and cost.
For more information on configuring and managing your ZoneHero deployment, see our Terraform Provider documentation.