V5 Slow Web Server
  • Hello,

    I looked in the discussions and saw no other reports of this, but I assume most people don't hit the web interface as much as I do.

    This request can take up to 5 seconds sometimes.
    time curl "http://127.0.0.1:8000/++image?cameraNum=1&width=375&height=281&quality=1" > /dev/null

    The quality, height and width options don't seem to change the response time much. Sometimes it's very fast at around half a second, but usually it's over a second.

    CPU running around 40% - most of that decoding cameras to do motion detection.

    If I close SS5 and open SS4 and repeat the request a few dozen times I might get 1 or 2 that take over a second. Is this fixable?

    Thanks!
    -captain

    PS. This just gave me the idea to stick response times into a time series database and graph them.
  • Provided the CPU usage of the Mac is reasonable (40% is fine) then the response time on this should normally be very fast.

    Two possible causes:

    1. If the incoming frame rate of the camera itself is low, then this will increase the time that SecuritySpy has to wait for the next frame before it can be delivered via the web server. What is the frame rate at which the camera is sending video to SecuritySpy?

    2. If you have checked the "Decompress incoming video frames only when required" option in the General preferences, this can significantly increase response times, as then SecuritySpy has to wait for the next I-frame in the stream before it can satisfy the web request, which may take several seconds. Do you have this option checked?
  • 1. This appears to happen on all of the cameras. They all run at least 20 fps. Camera 1 is actually currently configured to run 40fps with a 1s (40 frame) i-frame interval.

    2. It was checked. Unchecking that box seems to have made it worse. Definitely didn't get any better.

    I'm going to play around with fewer cameras enabled. My GPU (MSI GeForce GT 710 2GB) runs about 50% GPU usage and 75% memory usage. The CPU is 50-60% idle on average. I have 9 cameras enabled - one of them is a Logitech webcam, the other 8 are Dahua IP cameras 4-6MP.

    Additional detail: when I receive an image using the web interface as shown before (except redirect to a file instead of null) any motion in the image is almost always distorted. The same distortions are not present in the captured/saved video files. Examples (I have thousands more....):
    https://share.getcloudapp.com/mXum9KEp
    https://share.getcloudapp.com/5zuJgNDd
    https://share.getcloudapp.com/L1uknrzJ
    https://share.getcloudapp.com/KouexJLB

    This same distortion is now happening in SS4 too, so I believe the macOS upgrade is part of the culprit here. Thanks for the help!
  • Welp. I hate to say I found the problem, because this has been bugging me for so long, but I think it's one of the cameras. SecuritySpy doesn't indicate any particular issue, but disabling my Pool camera has sure improved the system performance overall.

    It's a IPC-HFW4631F-ZSA which turns out to be a firmware hacked (and locked) chinese-version camera with firmware from 2017. It supports H264H and an incompatible H265. I suppose I'll be replacing it shortly.
  • thanks for the update. did you disable each camera in SS, or simply unplug each one at a time? or?
  • I disabled all but 2. Tested. Things were good, then added them back one at a time. The Pool camera made the biggest difference. It's an oddball in my system. The rest are newer models with firmware from 2019.

    EDIT:
    I'm still getting video distortions. :(

    ...and, I just unchecked "Enable this camera" in the camera settings.
  • The video distortions look like decoding issues, and could be related to the slow web performance you are seeing. This seems to happen on newer macOS systems when the GPU gets overwhelmed with the decoding task. If you open Activity Monitor and select "GPU History" from the Window menu, what kind of GPU usage are you seeing?

    Try this: click on the SecuritySpy menu, and from the Debug submenu, check the option "Disable Hardware Accelerated Video Decoding". The quit and reopen SecuritySpy. How does this affect CPU usage, GPU usage, web response time, and the distortion issue?
  • The GPU runs about 75% average. sometimes spiking above that. I have another diagnostic app that makes it more clear than activity monitor. Activity monitor helped me prove it's giving me the real numbers. Quitting SS makes the usage drop to 0%. Checking the "disable hardware acceleration for decoding" in the debug menu (then quitting/reopening) did not change the GPU usage. When I quit SS it dropped to zero, but it went right back to 75% after re-opening SS. This is without camera windows being shown on the screen. Version 5.2. I tried checking both boxes (encode and decode), but the GPU always goes to 75% when SS opens. This sure feels like part of the problem.. Any ideas?
  • Here's a picture of the system stats. Maybe it's useful.
    https://share.getcloudapp.com/X6uDWGeJ
  • Would a better video card help? Any recommendations? Quadro P2000 or P4000 maybe?
  • Something different happened earlier today. The CPU and GPU usage dropped significantly, but SecuritySpy is still doing its thing. The curl request in the original post is taking 5-6 seconds regularly. I made a video to help demonstrate what the system looks like. This shows the video distortions; pay attention to the baby cam in the bottom left. The road cam in the top right doesn't ever seem to distort, but most of the others do. The camera in the top right only runs at low fps, or it begins turning green. I just have a plethora of problems. Any help is appreciated!

    The video:
  • I'm somewhat perplexed by these symptoms - the video decoding artefacts you are seeing are normally associated with a system that is overloaded, but your CPU and GPU usage are well within normal ranges.

    Would you be willing to allow us access to your Mac (e.g. via TeamViewer) so that I can connect and run some tests? I think this is going to be the best way forward. If this is OK, please email support@bensoftware.com with the TeamViewer details and let me know when would be a good time to connect.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!