No matter how good you get at capacity planning, don’t forget that it is just a very detailed guess about the future, so try not to over promise like the gentlemen below.
No matter how good you get at capacity planning, don’t forget that it is just a very detailed guess about the future, so try not to over promise like the gentlemen below.
Even though capacity planners naturally tend to focus on the peak minute of the peak hour of the peak day, remember that most complex commercial systems have other stresses in their lives. There are the additional things to factor in. For example:
Above you see the classic performance signature of machine driven work, a nearly instant-on load with no normal change in intensity as the day progresses. Also, the work runs through the system at a relentless pace because there is no think time.
Sometimes a well thought out solution that works during a peak day kills you at night, kills you on the weekend, or kills you at the end of the month or quarter. Don’t just meter the peaks. Meter all year, and notice when these timed or special events happen. The boss may decide to include these special events in your capacity planning, or they may just decide to take the chance that any special event will happen during a conveniently low demand time. Different businesses are willing to make different tradeoffs between money spent and risks mitigated.
When you present your capacity plan be prepared for at least one round of adjustments. Even with the safety margin and max utilization values built into the calculations, some managers will still be uncomfortable with your results.
Sometimes you are too close to a limit, and the boss will have you add resources to the plan. Sometimes a resource is seen as “too idle”, and that will bother them. Sometimes your results do not support their empire building goals or cost savings targets, and you’ll be asked to change the plan.
Adjustments can be made, but do what you can to make sure the plan sticks to the truth. If your boss tries to force you to lie or profoundly fudge the numbers or “reframe the truth”, do your best to resist.
Every organization is different. Some are nimble, some ponderous and slow, some have money to burn, and some won’t see new hardware for years. You need to factor these realities into your plans as capacity planning is only helpful when it is done with enough lead time to fix the discovered future bottlenecks. Some things to consider:
With time all things are possible, so the best advice is to start as soon as you can.
There are two situations where you create capacity plans that assume you have less computing resources than you have now: disaster recovery and budget cutting. In both cases the first thing that needs to be done is make some hard business decisions about suffering and money.
Is your company willing to let the users feel a little response time pain if a key system or device fails in order to save some money? Every company I’ve ever worked for had a different answer, and that answer changed depending on the market they live in, and their current financial situation.
As a capacity planner, you are looking for a clear statement about response time and throughput goals such as:
In the above bullets X is the thing you are considering doing without and could be as small as a comm line or as large as a whole datacenter.
At the end of the day, it is all about money. If you are asked to capacity plan for less hardware, and the chief consideration is money, then you need to know:
In many ways this is like playing the game Monopoly™ when you are low on cash. Suddenly you need to pay rent, so you have to return your buildings to the bank for the cash you need. You will select those buildings based on what they are worth and what they could make in rent as the game goes forward. The same is true in capacity planning. If the boss says he needs to save $200,000 in costs, then you need to know what eliminating a given machine will save you.
For example, your overall projected peak load is 150 transactions per second (TPS), and you have three front end machines that each take 1/3 of that load. To capacity plan for handling that peak load with one of the front end machines down, just divide the peak load by two machines rather than three. So at peak the two remaining machines will each need to handle 150TPS / 2 = 75TPS.
On a normal, non-peak day, each front end machine handles about 25TPS during the busiest part of the day, and the measured utilization of system resources is what you are going to use to scale up the load. To get the scaling factor you need for your capacity plan, divide your per-machine projected peak load by the measured load.
If at peak everything is working normally, each front end machine will be handling 150TPS / 3 = 50TPS, and thus it will be doing twice the work 50TPS / 25TPS = 2X of your metered day.
If at peak one front end machine emits a puff of greasy black smoke and dies, then the remaining two machines will each be handling 150TPS / 2 = 75TPS, and thus they will each be doing three times the work 75TPS / 25TPS = 3X of your metered day.
When doing this work, you can also scale the disaster up to the datacenter level (What if a hurricane takes out our North Carolina datacenter?) or down to a single communications line. You just have to figure out if X breaks, what fraction of the pre-failure load will the remaining hardware have to pick up. Then add that to the projected peak for which you are capacity planning and do the math.
There are as many disaster scenarios as there are things that can break. You might get overwhelmed thinking of all the possible combinations, but remember, you don’t have to plan for all scenarios, just the worst ones. If you need to plan for various troubles that will leave System X carrying 110%, or 250%, or 300% of the metered load, do the math for the worst case first. If the system can handle a 300% load increase, it can clearly handle 250% or 110% easily.
When looking to reduce equipment costs, you have to figure out how to do more, with less. It is almost never the case that there is some easily applied magic fix. Instead, typically, workload has to be moved to fewer systems which entails some unforeseen consequences and some risk to the stability and availability of your computing world. It can be done, but there are some things to which you need to pay attention:
Doing the work of moving workload, processes, files, and networks is a deeply detail-oriented, complex task. Start by creating your plan with what you know, then spend time checking all the things on this list and whatever else you think of. Most of your plan will work, some of it won’t. Adjust and recheck all your assumptions. Repeat this plan/recheck process until it all seems to work while keeping your boss in the loop to be sure the money saved is sufficient and the politics are working out as well.
Capacity planning should never be sold as a guarantee that all will be well at the next peak. No matter how good a performance person you are, you can’t offer that guarantee. Why? You cannot prove a negative. For example, you can’t prove there are no monsters waiting to get you while you sleep because no matter how carefully you check, you might overlook some spot (like the closet) where they are hiding.
Liebig’s Law clearly shows that even a small and obscure part of the transaction path can become a major bottleneck if given enough work to do.
Capacity planning is more like a pre-trip checklist to ensure you have what you need, and all systems on this list are good-to-go. Invariably, you will go on that trip, and somewhere along the way you’ll discover you forgot X, don’t have enough Y, and for the first time ever you need Z. That’s all bad news, but remember that your capacity planning effort found bottlenecks that would have limited your throughput even more.
Even if you use load testing to add to your confidence, no load test is perfect, so you still can’t honestly guarantee a trouble-free peak.
So, do capacity planning to the best of your ability with the things you do know about, load test to the best of your abilities, but make no absolute promises. If you get caught short on some resource, take the time before the next big peak to learn about that resource and to do a more complete plan next time. Unless this is the last peak before you retire, you need to think long-term.
Capacity Planning is projecting your current situation into a somewhat busier future. To do this work you need to know what is being consumed under a relatively stable load, and then you scale that number to the projected load. So if some component of your computing world is 60% busy under the current load, it most likely will be 120% busy (and thus a serious bottleneck) under 2X the current load.
To meter for capacity planning you should collect data from every part of your computing world that shows:
Essentially you are looking to see how close you are to hitting any limit to growth, no matter how insignificant.
If there are well understood and closely watched workload meters for your system (e.g., “Currently we are handling 5,500 transactions per minute”) then collect them. You can do capacity planning without a workload meter as, in most cases I’ve worked on, the boss asked for a general scaling of the current load like: “Can we can handle twice our daily peak load?”
It is best to meter when the system is under a stable load, one where the load is not changing rapidly, because then you can get several samples to be sure you are not seeing some odd things that are not connected to the overall load. Below we see some samples where the load is stable over time, but there are things to notice here.
Ignoring the sample at 12:15 for the moment, notice that the overall the load is stable. It will never be perfectly stable where each sample gives you exactly the same numbers. Some variation will always happen. Values plus or minus 10% are fine.
If the overall load is never stable, then pick some metered value, like X TX/min, and look at all your samples for any sample you collect that shows X TX/min (± 10%) and see if the other numbers you are tracking, like disk busy and CPU, are stable in relation to it.
In the 12:15 sample the CPU usage essentially doubles even though the disk busy and the TX/min number are stable. This is either some oddball thing that happened and is not normal, or perhaps at 12:15 every day this happens, or perhaps this happens 10 times a day at somewhat random times. Either set yourself to solving this mystery, or if you are sure this is a non-repeating event, ignore the 12:15 data.
This is why you just don’t meter for 20 minutes on one day when doing capacity planning. You’ll look at lots of data, over many days, and try to come up with a reasonable estimate of how busy everything is under a given load. If there are days where unique demands, not related to load, are placed on your computing world, be sure to meter through those times, too. The whole reason for capacity planning is typically to ensure you have enough resources to handle a peak load, even if it arrives on a day when the system has other things to do, too.
A common mistake people make is to look at the CPU consumption of a process and use that to estimate how much more work it could handle. They might notice that a process is only consuming six seconds of CPU per minute and thus deduce that the process is only 10% busy (60/6 =0.10) but that’s usually wrong. Processes do other things besides burn CPU. They wait for disk IO, they wait for other processes to return an answer they need, they wait for resource locks, etc. A process can be doing all the work it can and still burn only a small fraction of the CPU it could if it were just crunching numbers. Gather the per process CPU consumption, but don’t mistake it as a straight-forward way to gauge how busy a process is.
When metering for capacity planning, gather any data you can for limits that can be hit. Notice things that kill performance, or sometimes whole applications, when they get full, empty, or reach some magic number. Any limit you hit, will hurt.
Some examples of limits your computing world might hit: disk space, available memory, paging space, licensing limits on the application, number of server processes, maximum queue depth, networking port limits, database limits.
Also consider the limits that per-user or per-directory security and quotas bring to the party. Look for limits everywhere and record how close you are to them.
Capacity planning is projecting your computing world into a somewhat busier future to see if you have enough of everything to get the job done. Here I share a practical approach for doing capacity planning that boils all the performance data you have for any resource down to just four numbers and a simple calculation.
Doing capacity planning for any computing resource that gives you a utilization is essentially multiplying three numbers together (Utilization * Scaling factor * Safety Margin) and then comparing the result with your maximum utilization for the given resource. If the calculated utilization is greater than the maximum utilization, then you’ve found a future bottleneck. The number of times you will repeat this calculation and comparison depends on the size and complexity of your computing environment. What follows are a few hints on how to do this right.
Step one of capacity planning is to find a time that you want to base your capacity plan on. Pick a time when the users are sending your computing world a moderate, stable load and the users are happy with your overall response time and throughput. Your daily peak load is often a good place to start. Typically that time is decided by watching the system behavior over several days, or weeks, and then selecting some reasonably busy time. Usually, you start by looking at a key system’s CPU consumption as it is the one resource that all transactions consume. Let’s look at some data and pick a number.
In the above graph you see the CPU busy data from System X averaged over one minute and sampled every 5 minutes for most of Oct 24th and 25th. Hint: For capacity planning you don’t want a long average (ex: data averaged over fifteen minutes) as that can hide small but significant surges in demand.
All transactions pass through this computer. The first thing that jumps out at you is the sharp 90%+ busy peak in the middle of the night. A couple of good questions to ask are:
If this is a background job that runs in the middle of the night when nobody cares about response time, then you can ignore it. If the boss cares about response time 24×7, then you have to plan for this, too.
If this peak is the result of some event that suddenly and rapidly dumps work into the system (e.g. a computer coming back online after a communications disruption) then you need to plan for this. You might still go ahead and build your plan with the normal transaction load, but you’ll need to mention the possibility of this spike happening at the worst possible moment in your written capacity plan.
For the moment, let’s ignore the early morning peak, and change the scale on the Y-axis so we can see the data we really care about more clearly.
Now that we’ve trimmed the Y-axis to a max of 50% busy, the next question is which day’s peak to use. The daily peaks on the 25th are a bit higher and somewhat more consistent than the daily peaks on the 24th, so let’s focus on those peaks and redraw the chart to only show that one day.
Below we can see a sustained 45 minute long peak of 27% busy and a maximum recorded value of 29% busy.
The period where we see the sustained peak, holding steady through multiple samples, is a good place to start. It’s good to have multiple adjacent samples in agreement because it gives you confidence that the overall system was at a steady state.
The highest value recorded that day was 29% busy, but you’ll notice it is not a sustained peak. Someone may look at that chart and say you have to capacity plan based on the busiest moment. Here it makes little difference as 27% and 29% are not that far apart. However, sometimes there are bigger differences, and sometimes the person insisting on using the highest values is your boss. If your boss is adamant, then go with it. Why fight over a small difference? Pick your battles.
So now you’ve got two things: a time range for a steady state peak and a value for CPU busy (27%) on this system.
Before you declare victory and go out for a long lunch, look at the metering data from the other systems and devices in your computing world and see if they are showing a peak at about this time with about the same shape. It is entirely possible that the other systems in your computing world did not see this sustained 20 minute peak because it was caused by a little program someone ran unbeknownst to you on this system.
If you want to build a capacity plan based on this observed peak, it should also show up throughout your computing world during the same time and with the same magnitude. The meters should make sense to you at all times, not just when it is convenient.
The scaling factor is a number that represents how much busier the future is anticipated to be when compared with the time you sampled. Sometimes it is based in fact (e.g. you just bought a competitor and you know how much business they will bring), and sometimes it is a guess pulled right out of thin air. To get the scaling factor:
The scaling factor they pick will typically be an SRN (Suspiciously Round Number) and, in my experience, it is never exactly right, but it is often close. Humans are an amazing species. If you are tasked with making this guess, I recommend using the Delphi Technique as that can be quite helpful in getting an unbiased group opinion.
Capacity planning assumes that the resource demands of most applications scale linearly because, within normal boundaries, they do. To be precise, 99% of the computer programs I’ve seen increase their resource consumption in direct proportion to their throughput. If you push twice the work though an application, it will consume close to twice the computing resources such as: CPU cycles, disk IO’s, packets sent/received. The exceptions to this rule are:
When capacity planning, none of the above apply. You don’t capacity plan a system reboot or an application restart, you don’t plan to have the peak load experience a bottleneck, and you can’t plan for all possible errors. However, you can create a capacity plan that takes into account the load being shifted to the remaining systems when a system fails. If three devices are caring the user load and each device is 30% busy. When one device fails, the other two will each take half that load and so they should each be about 45% busy.
Convert any scaling factor they give you into a multiple of one. So, for example, “Plan for a 30% increase” becomes 1.3, “Twice the load you metered” becomes 2.0.
Every company has a level of corporate courage and a certain aversion to pain. These attributes are shaped by their people, their culture, how much money they have to spend, and by their recent disasters. It is the rare company that likes to hang by a fingernail on the edge of disaster. Only a fool will insist upon planning for a peak load where every resource is at its maximum utilization as there is no margin for error. Most people feel better, and make better decisions, when they have a margin of safety. Besides, capacity planning is not a perfect science:
Do not let the person that gave you the scaling factor tell you that it includes the safety margin. You need to keep these two values separate. The scaling factor is your estimate of the future load; the safety margin is how sure you are about that estimate.
The safety margin inflates your projected utilizations by the percentage that you choose. Most companies I’ve worked with have chosen a safety margin value between 10% and 50%, with the most common values in the 20% range. When using this in capacity planning, convert it into a multiple of one. A 20% safety margin becomes 1.2.
For resources that provide a service there is a utilization beyond which the delays caused by queuing effects become too painful. Your company may have pre-defined corporate-wide guidelines for max utilization for given resources. If so, use them. If not, then you’ll be choosing a number between 50% and 80-90%. Here is some guidance to help you choose.
According to queueing theory, any device (service center) that is 50% busy will have an average response time of twice the service time as there is on average one job to be processed before you get your turn to use the device. The slower the device is, relative to the other things in your computing world, the more painful this math becomes. In the late 20th and early 21st centuries computers used spinning magnetic disks for long-term storage. Disks were the slowest part of any computer system by several orders of magnitude and thus, the rule of thumb was to keep the utilization of a disk below 50%. If we switch to solid state disks, their vastly lower service time, which translates into a lower wait time and thus a lower response time for a similarly busy device, would justify picking a higher max utilization number.
When picking the max utilization for a device, there is always the temptation to shove money into the discussion with comments like: Those disks were very expensive, and now you are telling me I can only use X% of their capacity. Your reply to incredulous comments like that should point out, in a gentle way, that the cost of running some device at 100% busy is remarkably bad response times for the customers – see queuing theory.
Device exclusivity plays a big part in the number you pick for max utilization as well. When a process needs CPU, any one of the multiple CPU’s in the system will do. If you can go to many places to get serviced then the odds are good that one of them will be free and that will hold down response time as the utilization climbs toward 100%.
On the other hand, if the data you need is on one device (e.g. reading a specific record on a specific disk), then you can only go to that device, and the response time becomes ugly at a much lower average utilization.
To pick a max utilization number for a given device, start by doing your homework; read the manuals, search the web, and then talk to the vendor. If you are laughing at my suggestion to start by reading rather than calling, remember that when you call, you will end up talking to either: people who don’t know, so they bluff and bluster, or people who do know. If you start as an informed person, you can quickly identify and disregard the people who don’t know. If you luck out and get to talk to someone who does know, they are more likely to give you a rich and complete answer because it is clear that you’ve done your homework.
When calling, I’ve had the best luck starting with the technical sales people who are assigned to your account, and then people in the professional services or customer service group. Also remember that questions of max utilization have direct impact on how many of these devices your company will buy. People may be very cautious in their responses because nobody working for a vendor wants to screw up a potential sale.
You can also experimentally select a max utilization value of some resource through testing by adding load to the resource until you see the response time start to grow unacceptably. The number you get should be between 50% (for really slow resources) and 80-90% for the speediest resources where the incoming work also has many service centers to choose from.
A process executes code until it has to wait for something like a reply from another process, a lock, or an IO to complete. CPU consumption for a process does not tell the whole story of how busy it is. Here are some guidelines to help you figure that out:
When you have a max utilization (expressed as a number from zero to one) for all your resources then you are ready to do some capacity planning.
Now you are ready to scale up to the projected peak load. The formula is straight forward:
Utilization * Scaling Factor * Safety Margin = Projected Peak
Imagine you have a resource that is 40% busy (utilization is 0.4), and you need to plan for a peak load that is 50% larger than what you are seeing now (scaling factor is 1.5), and you are reasonably sure of your projected peak load within about 10% (safety margin is 1.1).
Doing the math you get 0.4 * 1.5 * 1.1 = 0.66 and now you know this resource will be 66% busy at the projected peak load. You’ve determined the max utilization for this resource is 75%, and so you feel reasonably sure that this resource will not be a bottleneck at your projected peak. Now do that calculation for all your other resources.
When presenting capacity planning results, you can quickly overwhelm the audience with numbers and, despite their keen interest in your results, they will stop listening, reading, and caring after just a few sets of this data. To help them absorb the results, show the data graphically and use the same colors, line size, and wording in each chart for the measured, projected, and maximum utilizations.
That way a quick glance is all that is needed to know if there is a problem at the projected peak and how close to the max utilization this thing is. Also take into consideration that you’ll be projecting your results in color, but your audience likely will be holding a blank & white photocopy in their hand. Strive for clarity.
Capacity planning can fail when a resource, not included in the plan, bottlenecks under the peak load and ruins your post-peak Tiki bar celebration. Capacity planners (i.e. you)
should learn from previous failures. If you run out of something, figure out how to meter that thing, and add it to the next capacity plan. Don’t fall in the same hole twice.
There is a lot more on capacity planning, and many other useful performance insights, in my book: The Every Computer Performance Book