doitandbedone/ispyagentdvr-docker

Very high CPU load

instantdreams opened this issue · 3 comments

Affected Version
v4.6.4.0

Describe the bug
Server CPU load is very high:

%Cpu(s): 71.2 us, 11.2 sy,  0.3 ni, 13.7 id,  0.0 wa,  0.0 hi,  3.6 si,  0.0 st
MiB Mem :  31983.6 total,   4673.3 free,  23139.4 used,   4170.9 buff/cache
MiB Swap:    977.0 total,    977.0 free,      0.0 used.   8106.9 avail Mem

    PID USER      PR  NI    VIRT    RES    SHR S  %CPU  %MEM     TIME+ COMMAND
1999927 root      20   0 5254804 482984  66420 S 232.6   1.5   2398:37 Agent
2000349 root      20   0  992328 142328  15396 S  11.6   0.4  20:38.34 frigate.process
3141354 root      20   0  935320 156568  24320 S   9.3   0.5  25:06.86 ffmpeg
3484819 root      20   0  934768 112732  24520 S   8.6   0.3   0:03.71 ffmpeg
3483169 root      20   0  935088 119272  23888 S   8.3   0.4   0:12.70 ffmpeg
3480044 root      20   0  935016 120528  24060 R   7.3   0.4   0:26.23 ffmpeg
2000308 root      20   0  815392 118848  21284 S   5.6   0.4  52:57.93 frigate.detecto
1999568 root      20   0 2964804 531800  47612 S   3.7   1.6  68:07.26 python3
3389880 root      20   0  919288  58592  24676 S   3.0   0.2   3:34.53 ffmpeg
2000387 root      20   0 1023100 130760   7832 S   2.3   0.4  23:59.17 python3
2000460 root      20   0 1023100 124720   7832 S   2.3   0.4  23:04.50 python3
2000468 root      20   0  987940 122944   7832 S   2.3   0.4  24:29.98 python3
   1132 root      20   0 2941912 116912  53564 S   2.0   0.4  44:11.67 dockerd
2000310 root      20   0 1768444 109204  11828 S   2.0   0.3  25:05.46 frigate.output

Processor details:

$ lscpu
Architecture:                    x86_64
CPU op-mode(s):                  32-bit, 64-bit
Byte Order:                      Little Endian
Address sizes:                   39 bits physical, 48 bits virtual
CPU(s):                          4
On-line CPU(s) list:             0-3
Thread(s) per core:              2
Core(s) per socket:              2
Socket(s):                       1
NUMA node(s):                    1
Vendor ID:                       GenuineIntel
CPU family:                      6
Model:                           142
Model name:                      Intel(R) Core(TM) i3-8109U CPU @ 3.00GHz
Stepping:                        10
CPU MHz:                         3599.999
CPU max MHz:                     3600.0000
CPU min MHz:                     400.0000
BogoMIPS:                        6000.00

Steps To Reproduce
Steps to reproduce the behavior:

  1. Install Debian 11.5 on an Intel NUC8i3BEH
  2. Install Docker engine and Docker Compose plugin
  3. Set up docker compose files for frigate and ispyagentdvr
  4. Connect a Coral TPU and configure Frigate to use it
  5. Configure iSpy Agent DVR docker container to monitor 12 RTSP cameras
  6. Monitor CPU usage over several months and note that the iSpy Agent DVR docker process is consistently high

Expected behavior
For the CPU usage to not be over 100% regularly.

Reproduction rate
This happens a lot. But not alot.
image

Screenshots
Here's the general CPU load over the last 28 days:
image

Here's the CPU usage for just iSpyAgentDVR over the same timeframe:
image

Host System Information (where ispy agent is running/hosted):

  • OS: Debian 11.5 headless

Client System Information (device accessing the web portal, if applicable):

  • OS: Windows 10
  • Browser: FireFox
  • Browser Version: 111.0.1

Additional Information
I realise that I am running Frigate and iSpy Agent on the same machine, but I feel there should be lower CPU load than I have been experiencing. Any ideas on how to tweak the configuration to reduce this?

it depends really on what it's doing and the resolution of your cameras and whether you are recording raw or encoding and if you have a GPU available and if that's being used or not... and how many clients (browsers) you have connected etc etc

It's also possible that you're using a build that doesn't have GPU acceleration on it - the PPAs we were using were removed and I just added GPU support back into the build script. The docker script currently also needs to be updated with GPU support.

All very fair points. I have:

  • 4 AMCREST @ 4k
  • 6 Wyze V2 @ 1080p
  • 1 Wyze Pan @ 1080p
  • 1 Wyze V3 @ 1080p

The Google Coral CPU is used by Frigate. The Intel QSV is available to iSpy. I am using the latest docker build.

The latest docker build doesn't have GPU support - i've updated it but i don't think it's gone live yet (needs to be approved)