Custom Metric Scaling
What you'll learn: How to scale your infrastructure based on metrics unique to your application, not just generic system metrics.
Beyond Built-In Metrics
You've already learned about scaling based on standard metrics like CPU utilization or network traffic. But what if your application's true health depends on something more specific—like the number of items in a work queue, user logins per minute, or database connection pool saturation?
Custom metric scaling lets you publish application-specific measurements to your cloud provider's monitoring service, then create scaling policies that respond to those custom signals.
How It Works
Instead of relying solely on infrastructure-level metrics, you instrument your application to send custom data points to a monitoring service (like CloudWatch, Azure Monitor, or Google Cloud Monitoring). These might include:
- Queue depth (jobs waiting to be processed)
- Active user sessions
- API request latency at the application level
- Business metrics like orders per second
Once published, you treat these custom metrics just like built-in ones—creating target tracking, step, or simple scaling policies that trigger based on your thresholds.
Why It Matters
Scaling on CPU alone might be too late: your app could be overwhelmed with requests but show only 60% CPU usage. A custom metric like "pending requests in queue" gives you a more direct signal of actual demand, allowing faster, smarter scaling decisions.
Example: If your queue depth exceeds 100 items, scale out; if it drops below 20, scale in.
Key Takeaway: Custom metric scaling lets you build scaling policies around what truly matters to your application's performance, not just generic infrastructure signals.