You should use load average to evaluate CPU requirement.
To interpret CPU usage and Load Average numbers you should take into account
- total number of physical cores in a system (all CPUs)
- is HyperThreading enabled
- in Linux Load Average also includes processes in uninterruptible sleep state waiting for I/O
- CPU usage and Load Average numbers interpretation depends on number of logical cores
- you should check per core CPU statistics to be more accurate. In
top
press '1' for per core stat and 't' to turn graph bars.
i7-7700T have 4 physical cores, and with HT enabled 8 logical cores https://ark.intel.com/content/www/us/en/ark/products/97122/intel-core-i77700t-processor-8m-cache-up-to-3-80-ghz.html
CPU usage, %
show utilization - percent of time when CPU is not idle and execute tasks scheduled by OS scheduler.
Each core may used up to 100% so max usage capacity of 8 cores is 800%.
So two ffmpeg processes utilize all 8 cores at 460.7% + 331.7% = 792.4%.
Whole CPU stat in this line
%Cpu(s): 19.9 us, 0.7 sy, 78.1 ni, 1.1 id, 0.0 wa, 0.0 hi, 0.1 si, 0.0 st
Here 19.9% of user space time + 78.1% of nice time = 98% of CPU usage by userspace program.
So CPU cores are busy at 98% by all of userspace processes with 79,2% executing two ffmpeg processes.
Because transcoding is a CPU bound task, you will almost always have close to 100% utilization on any CPU.
Load Average
is an average, over some period, number of threads executed + number of threads waiting to be executed.
One core execute one thread at a time slice.
8 cores can execute 8 threads at a time slice.
System overloaded if Load Average > number of logical cores.
This means the OS scheduler cannot allocate the next time slice to some threads due to the busy cores and puts them in a run queue to wait for execution.
Second number in Load Average = 25.65 on system with 8 cores means:
- in average 8 threads executed during last 5 minutes
- in average 17.65 threads waits in run-queue during last 5 minutes
So system overloaded on 17.65/8*100=220.6%.