Why Should I Care?
It depends who you are and what you do :)
If you are a DevOps or SRE engineer, you want to:
- Save some sleepless nights when PagerDuty alerts go off because your users have a terrible user experience. On our platform, we’ve observed that poorly distributed resources and old scalability rules are the keys to more than 25% of live site incidents.
- Avoid stressful monthly cloud bill reviews. A good chunk of engineering time goes to analyzing (and reacting to) cloud bills. You usually get those questions when the bill significantly goes up without clear business justification. For example, if your bill goes up in one month by 30% without adding that many users or features, this is a big deal for the business and leadership in your company.
If you are a developer, you want to:
- Learn how to write better cloud-native microservices by correlating your code and changes to the user experience. Know if your deployed microservice is getting better performance for the resources it got or not. For example, is the new feature or recent bug fix consuming too many resources?
- Understand how your microservice behave under real workloads. You want to know if your microservice started to behave unexpectedly at specific workloads or conditions without doing any explicit instrumentations.
If you are an engineering manager, you want to:
- Run lean and avoid infrastructure debt. Infrastructure debt is similar to your architectural or code debts. You need to make the best decisions to prevent a slowdown in the fullness of time. This kind of debt is accumulated when the team keeps allocating the wrong infrastructure under the pressure of moving fast. It becomes harder and harder to keep releasing with decent velocity under the increasing demand to run efficient infrastructure.
Why Capacity Management is Pain In The Neck?
Capacity management is a moving target. It is impacted by users workloads, changing application/system architecture, and evolving infrastructure. Multiple persons and roles impact applications and infrastructure architecture. They work with different motivations that are sometimes conflicting.
Capacity management is impacted by users workloads, changing application/system architecture, and evolving cloud infrastructure.
Also, each one of these three factors moves at a different velocity.
- Users workloads change every few seconds or minutes, which impacts your applications performance and infrastructure utilization.
- Application architecture changes every few months, if not faster,depending on the team’s velocity. It impacts users experience and the use of infrastructure capacity.
- Infrastructure technologies evolve every few months. It impacts the performance of the application, and eventually user experience. For example, using compute-optimized instances improves the performance of CPU intensive microservices. Using the right type of desks and network interfaces positively impact your databases.
What Should I Do?
If you are a DevOps or SRE, you need to focus on the following
Measure, Characterize, and link users workloads to microservices
- Characterize workloads by measuring their intensity and latency throughout the day.
- Figure out if there are hourly, daily, weekly, or seasonal patterns. Quantify these patterns, i.e., number of API call of each feature, variability of workload.
- Profile each feature by identifying impacted microservices and measure CPU, memory, and I/O consumed to satisfy each API call (or feature).
Performance and Profile of Microservices
- For each microservice understand if you are over or under budgeting resources. If you don’t have a budget, at least create a baseline from workloads you measure in the previous step.
- Profile different microservices by identifying whether they are CPU, memory, or I/O intensive.
- Identify zombie VMs. These are VMs that can be killed and have their current workloads moved to other VMs. Just look at the three common dimensions, CPU, memory, and I/O (network mainly), to identify these underutilized VMs.
- Match services profiles to the right VMs. Running your microservices to a general compute VM does not save your day. If your services are compute-intensive, you need to run them on compute-optimized instances, such as C5 family on AWS. The C5 family will give you much higher performance and scalability value for each dollar you pay to AWS.
Note: Below illustration is a sneak peek into my next article. I’ll explain in my upcoming article a step by step how you should track these
If you are a Developer, you need to focus on
- Create a baseline for your microservices. How much horsepower (CPU, memory, and I/O) does your microservice need to serve a specific unit of workload per second? For example, how many API requests per second can your microservice serve with 2 CPU cores, 4GB memory, and 10Gbits network? Baseline your microservice at different workloads
- Track if this baseline you created changes from one release to another. A common mistake here is not tracking minor releases. Sometimes minor release introduces bugs that disrupts that pipeline significantly. You want to know about that as soon as it happens.
If you are an engineering manager, work with your team on these
- Figure out the right KPIs (Key Performance Indicators). A single KPI won’t give you the full picture of your capacity. Your team should track at least one KPI per capacity dimension. Here you go some examples:
(1) Cost KPIs: cost per user or cost per operation (direct and indirect), or cost per microservice,
(2) Performance KPIs: APIs latency (90, 95 and 100 percentiles of users),
(3) Resources KPIs: cost per CPU, effective CPU cost (utilization included), cost per memory GB.
- Capacity management is the dark side of cloud-native applications that is usually ignored.
- Capacity management is the science, and art, of balancing performance, cost, and resources.
- You should care about capacity management because it will save you sleepless nights, difficult questions around the bill, make you a better cloud-native software developer, and eliminate the cloud infrastructure debt that can accumulate very quickly.
- Capacity management is a pain due to many factors impacting it, namely: users workloads, changing application/system architecture, and evolving cloud infrastructure.
- Measure, Characterize and link users workloads to microservices
- Create a reasonable KPI for each of the factors impacting your capacity management.