IOS How to debug 9 seconds cpu time over 36 seconds (25% cpu average), exceeding limit of 15% cpu over 60 seconds - swift

The high cpu usage rate threshold looks to have been lowered on iOS 15. Possibly from 80% in 60sec to 15% in 60sec? I have noticed that my app does NOT run correctly on IOS 15 and the background operations seem to stop like location, and some timers... I have a lot of #Published property's being updated while in the background, would this affect the background operations terminating after ~40 seconds in the background? If So how would I go about Updating my UI and keeping the constant updates to the published property.
I am getting the message:
Event: cpu usage
Action taken: none
CPU: 9 seconds cpu time over 36 seconds (25% cpu average), exceeding limit of 15% cpu over 60 seconds
CPU limit: 9s
Limit duration: 60s
CPU used: 9s
CPU duration: 36s
Duration: 35.85s
Duration Sampled: 25.92s
Steps: 5

Related

CPU utilization calculation

I've read in many places that a simple and decent way to get the % of CPU utilization is by this formula:
CPU utilization = 1 - p^n
where:
p - blocked time
n - number of processes
But i can't find an explanation for it. Seems it has to do with statistics, but i can't wrap my head around it.
My starting point is: if i have 2 processes with 50% wait time, then the formula would yield 1 - 1/4 = 75% CPU utilization. But my broken logic begs the question: if one process is blocked on I/O and the other is swapped in to run when the first is blocked(whatever the burst is), that means that while one waits, the second runs and their wait time overlap. Isn't that 100% CPU utilization? I think this is true only when the first half of the programs is guaranteed to run without IO need.
Question is: How is that formula taking into account every other possibility?
You need to think in terms of probabilities. If the probability of each of the cores to be idle (waiting for IO) is 0.5 then the probability of the CPU to be in idle is the probability of all of the cores to be in idle at the same time. That is 0.5 * 0.5 = 0.25 and so the probability the CPU is doing work is 1 - 0.25 = 0.75 = 75%
CPU utilisation is given as 1 - probability of CPU to being in the idle state
and CPU remain in the idle state when all the process loaded in the main memory is blocked time(I/O)
So if n process has wait time of 50% the probability that all the process are in
block(I/O) state

Amazon RDS Strange metrics CPU Credit Balance

We have RDS PostgreSQL instance with type db.t2.small . And we have some strange moment with cpu credit balance metrics .
CPU Credit Usage not growing but balance is down to zero . Anybody know in what could be problem? (RDS instance working fine without any problems).
I am seeing the same behavior with my T2-micro free tier RDS instance. My hypothesis right now is that the service window is when the instance is getting rebooted or hot swapped, resulting in a new instance with the default baseline number of credits. This makes Saturday night more appealing than Sunday night in order to be sure by the next business day credits re-accumulate.
From the documentation, it looks like CPU credits expire 24 hours after being earned.
CPUCreditUsage
[T2 instances] The number of CPU credits consumed by the instance. One
CPU credit equals one vCPU running at 100% utilization for one minute
or an equivalent combination of vCPUs, utilization, and time (for
example, one vCPU running at 50% utilization for two minutes or two
vCPUs running at 25% utilization for two minutes).
CPU credit metrics are available only at a 5 minute frequency. If you
specify a period greater than five minutes, use the Sum statistic
instead of the Average statistic.
Units: Count
CPUCreditBalance
[T2 instances] The number of CPU credits available for the instance to
burst beyond its base CPU utilization. Credits are stored in the
credit balance after they are earned and removed from the credit
balance after they expire. Credits expire 24 hours after they are
earned.
CPU credit metrics are available only at a 5 minute frequency.
Units: Count
https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/rds-metricscollected.html

Plesk: health monitoring thresholds per core or total?

plesk has a built-in health monitoring which lets you configure alarm thresholds for automatic notification. most of these thresholds are percentage-based to flag a notification if memory or cpu usage gets too high.
i'm having trouble determining how these percentages are measured. measuring for memory is easy (we're dealing with a fixed figure here) but cpu usage is more complicated on multi-proc servers.
CPU Info:
Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
Byte Order: Little Endian
CPU(s): 8
On-line CPU(s) list: 0-7
Thread(s) per core: 2
Core(s) per socket: 4
Socket(s): 1
NUMA node(s): 1
Vendor ID: GenuineIntel
CPU family: 6
Model: 42
Stepping: 7
CPU MHz: 1600.000
BogoMIPS: 6784.52
Virtualization: VT-x
L1d cache: 32K
L1i cache: 32K
L2 cache: 256K
L3 cache: 8192K
NUMA node0 CPU(s): 0-7
Now am i right in thinking, that if a single core hits the 90% then this would trigger the Alarm on the Health Monitoring?
Most of my Flags are from 80% = Yellow to 90% = Red
And its pretty much always on Red, I believe this is because its Multi Core and the health tool is working on a single core.
if i use the command TOP with Shift and I
Then i get the overall CPU process, and its nothing along the lines as to what the health monitor is showing me the total % is.
I dont know if i have picked up false information or been miss guided, But maybe someone can help steer me in the right direction, or shine a little light on it at least
:)
Thanks
After alot of posts, Troubleshooting and pestering, i finally found the answer.
In Short, YES Plesk Health Monitoring does not really account for any core >1
So in my case 6 cores, When Core 6, Flicks to 80% for 1 second, The alarm is triggered.
But when you work on a Average, the CPU does not hit 12%
I asked this, over in the official Plesk Forum, and failed to get a response.
Many Serve companys and partners of Plesk, One did respond and say its a known issue that causes alot of headacks
You can increase your Load Average, from 1 minute to 15, This will reduce the alerts alot, Or well in my case it has.
1 Minute with CPU hitting 80% = Alarm
15 Minutes, CPU hits 80% for 30 seconds, Its average on the 15 minutes is 20% = No Alarm :)

Calculate CPU Utilization

i have an task to calculate CPU utilization, I have 4 proccess
P1 wait for I/O 30% of his time.
P2 wait for I/O 40% of his time.
P3 wait for I/0 20% of his time.
P4 wait for I/0 50% of his time.
my result is 0.99999993...it seems to me unreasonable
The probability that all processes are waiting for I/O (and therefore the CPU is idle) is:
0.3 * 0.4 * 0.2 * 0.5 = 0.012
The CPU is therefore busy with a probability of: (1 - 0.012) = 0.988, i.e. CPU utilization = 98.8%.

Application failed to launch in time... but it's only taking 2 seconds?

Our application is crashing, and the crash log says;
Application Specific Information:
com.xxxx.xxxxx failed to launch in time
elapsed total CPU time (seconds): 2.120 (user 1.200, system 0.920), 11% CPU
elapsed application CPU time (seconds): 0.800, 4% CPU
...
Unknown thread crashed with unknown flavor: 5, state_count: 1
I'm sure it can't be crashing out because it's taking a whopping 2 seconds to launch! Does anyone have any other ideas why we might be getting this message?
Thanks in advance,
The two seconds are CPU time, the elapsed real time was probably longer (with 11% CPU load, it would be more like 20 seconds).