blakeblackshear / frigate

NVR with realtime local object detection for IP cameras
https://frigate.video
MIT License
19.21k stars 1.76k forks source link

[Support]: Terribly slow on Docker with multiple cameras #4802

Closed evolucja closed 1 year ago

evolucja commented 1 year ago

Describe the problem you are having

Hi, I am having troubles with my Frigate Docker instance. Browsing Recordings / Events is getting terribly slow after a few days of running. Sometimes it's not possible to view them at all as on the screenshot: image

After I restart the container, the page opens correctly but is still quite slow (16s): image

This is my storage configuration: image

/mnt/hd103j is HDD the other locations are SSD

any idea?

Version

0.11.1-2EADA21

Frigate config file

# yaml-language-server: $schema=http://10.0.0.33:5000/api/config/schema
mqtt:
  host: 10.0.0.33 
  user: frigate
  password: xxxxxxxxxxxxxxx
  stats_interval: 10

detectors:
  coral_pci:
    type: edgetpu
    device: pci

ffmpeg:
  output_args:
    record: -f segment -segment_time 10 -segment_format mp4 -reset_timestamps 1 -strftime 1 -c:v copy -c:a aac
#   hwaccel_args:
#     - -hwaccel
#     - vaapi
#     - -hwaccel_device
#     - /dev/dri/renderD128
#     - -hwaccel_output_format
#     - yuv420p

# Optional: birdseye configuration
birdseye:
  # Optional: Enable birdseye view (default: shown below)
  enabled: True
  # Optional: Width of the output resolution (default: shown below)
  width: 1920
  # Optional: Height of the output resolution (default: shown below)
  height: 1080
  # Optional: Encoding quality of the mpeg1 feed (default: shown below)
  # 1 is the highest quality, and 31 is the lowest. Lower quality feeds utilize less CPU resources.
  quality: 8
  # Optional: Mode of the view. Available options are: objects, motion, and continuous
  #   objects - cameras are included if they have had a tracked object within the last 30 seconds
  #   motion - cameras are included if motion was detected in the last 30 seconds
  #   continuous - all cameras are included always
  mode: continuous

record:
  enabled: true
  retain:
    days: 14
  events:
    retain:
      default: 30

snapshots:
  enabled: true
  bounding_box: true

live:
  height: 1080

objects:
  # Optional: list of objects to track from labelmap.txt (default: shown below)
  track:
    - person
    - bicycle
    - car
    - motorcycle
    - bus
    - cat
    - dog

cameras:
  bedroom: 
    ffmpeg:
      inputs:
        - path: rtsp://10.0.0.108:8554/bedroom
          roles:
            - detect
            - rtmp
            - record

    rtmp:
      enabled: false # <-- RTMP should be disabled if your stream is not H264
    detect:
      width: 1920
      height: 1080

  livingroom: 
    ffmpeg:
      inputs:
        - path: rtsp://10.0.0.108:8554/livingroom
          roles:
            - detect
            - rtmp
            - record
    rtmp:
      enabled: false # <-- RTMP should be disabled if your stream is not H264
    detect:
      width: 1920
      height: 1080
    objects:
      filters:
        person:
          min_score: 0.6

  hall: 
    ffmpeg:
      inputs:
        - path: rtsp://10.0.0.108:8554/hall
          roles:
            - detect
            - rtmp
            - record
    rtmp:
      enabled: false # <-- RTMP should be disabled if your stream is not H264
    detect:
      width: 1920
      height: 1080

  door: 
    ffmpeg:
      inputs:
        - path: rtsp://10.0.0.108:8554/door
          roles:
            - detect
            - rtmp
            - record
    rtmp:
      enabled: false # <-- RTMP should be disabled if your stream is not H264
    detect:
      width: 1280
      height: 720

  garage_1: 
    ffmpeg:
      inputs:
        - path: rtsp://10.0.0.108:8554/garage_1
          roles:
            - detect
            - rtmp
            - record
    rtmp:
      enabled: false # <-- RTMP should be disabled if your stream is not H264
    detect:
      width: 2592 
      height: 1944 

  garage_2: 
    ffmpeg:
      inputs:
        - path: rtsp://10.0.0.108:8554/garage_2
          roles:
            - detect
            - rtmp
            - record
    rtmp:
      enabled: false # <-- RTMP should be disabled if your stream is not H264
    detect:
      width: 2592 
      height: 1944

Relevant log output

-

FFprobe output from your camera

-

Frigate stats

{"bedroom":{"camera_fps":5.1,"capture_pid":235,"detection_fps":2.2,"pid":222,"process_fps":5.1,"skipped_fps":0.0},"detection_fps":2.2,"detectors":{"coral_pci":{"detection_start":0.0,"inference_speed":11.97,"pid":216}},"door":{"camera_fps":5.0,"capture_pid":241,"detection_fps":0.0,"pid":230,"process_fps":5.0,"skipped_fps":0.0},"garage_1":{"camera_fps":5.1,"capture_pid":243,"detection_fps":0.0,"pid":232,"process_fps":5.1,"skipped_fps":0.0},"garage_2":{"camera_fps":5.1,"capture_pid":245,"detection_fps":0.0,"pid":233,"process_fps":5.1,"skipped_fps":0.0},"hall":{"camera_fps":5.1,"capture_pid":239,"detection_fps":0.0,"pid":229,"process_fps":5.1,"skipped_fps":0.0},"livingroom":{"camera_fps":5.1,"capture_pid":236,"detection_fps":0.0,"pid":225,"process_fps":5.1,"skipped_fps":0.0},"service":{"latest_version":"0.11.1","storage":{"/dev/shm":{"free":239.8,"mount_type":"tmpfs","total":268.4,"used":28.7},"/media/frigate/clips":{"free":100651.3,"mount_type":"ext4","total":983350.1,"used":832671.8},"/media/frigate/recordings":{"free":100651.3,"mount_type":"ext4","total":983350.1,"used":832671.8},"/tmp/cache":{"free":98.1,"mount_type":"tmpfs","total":100.0,"used":1.9}},"temperatures":{"apex_0":42.3},"uptime":640,"version":"0.11.1-2eada21"}}

Operating system

Other

Install method

Docker Compose

Coral version

M.2

Network connection

Wired

Camera make and model

TP-Link

Any other information that may be helpful

No response

NickM-27 commented 1 year ago

It seems the HDD is too slow or having some sort of other problem. I have frigate accessing the HDDs on my NAS and the response times are ~ 1 second when the drive is spun down and 100 ms when the drive is already spun up. I'd also recommend doing a SMART test and seeing what the HDD reports

edit: also I'd recommend storing the database file on the SSD instead of the HDD. This can be done by creating a separate database folder on the ssd and adding

database:
  path: /path/to/db/frigate.db

to the config

evolucja commented 1 year ago

Hi, many thanks. I replaced disk as it was causing some read errors and moved database to SSD. Let's see what happens.