1

Below are two images from our Azure 'App Service Plan', which hosts our application. We recently tried scaling up, but it did not solve the issue seen below.

Our 'Max CPU' peaks throughout the day, everyday..but this is the MAX aggregation. These are transient spikes. Meanwhile, our AVG aggregation of cpu percentage is normal (second photo).

Is it expected to have max cpu transient spikes, like seen in the first picture, or is this abnormal?

Thank you!

Max CPU max cpu

Average CPU average cpu

2 Answers 2

2

It's aggregation rule, not the actual usage. When metrics are collected, they have (for CPU) a single metric: current CPU load. If metrics are collected 6 times a minute, there are 6 values. When large interval is shown, it's usually does not show all data, but perform aggregation. F.e. if aggregation is down to 10-minute interval, than all data in this interval are collapsed into one number. There are different functions to do so: min, max, avg, median, etc.

One away is to average (your second chart). Another is show the maximum found peak on that interval (your first char). Aggregation on averages tends to hide peaks, aggregation on max'es tends to swell peak use unreasonably. If you have 10 minutes aggregation window, and during this moment some process consumed 100% for 0.1 second, and that 0.1 second was the moment metrics were gathered, you'll have 10-minute interval of 100% CPU use (when 'max' aggregation is used).

2
  • This helps me understand what I'm seeing (it will aggregate max cpu within the specified aggregation timeframe), but does not help me understand if this behavior is expected in normal circumstances. I guess we should look into exactly what's causing the transient spikes? Sep 2, 2021 at 14:29
  • 1
    I usually have atop installed on server. It very coarse (15 minutes samples), but it records tons of historical information, including PIDs of processes, their command line and CPU consumption. It's a bit hard to get used to it (Use '?' for help), but as soon as you familiarize yourself with it, it's a best low-invesment emergency investigation tool I saw. Sep 4, 2021 at 7:24
0

That depends a lot on the application running on it. If it is doing CPU intensive work it will probably spike the CPU usage as high as it can. The difference you should see from upgrading the hardware. Is that the tasks it is working on will complete faster.

I don't know anything about the app you're trying to run. And therefore don't know if it is a multi-threaded application that seems to run as it should during these spikes or if it is a single-threaded application that seems to hang during the spike? In the first case I wouldn't bother much. But in the second case i would probably look into either upgrading the CPU evern more or, if I got access to the source code of the app try to see if it was possible to optimize the CPU intensive task.

2

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.