Analytics resource calculation¶
Analytics uses memory for models, decoded frames and concurrent camera processing. Consumption depends on model and computation service versions, selected device, resolution and analysis mode. Calculate it separately from video recording and delivery.
The inference service detects and processes objects; identification matches recognized objects. These services and the media layer can run on different nodes. On one server, add their consumption to Watcher, the database and the OS.
GPU memory calculation¶
First check that the chosen computation service sees the GPU and supports the required algorithm on it. Containerized CUDA needs access to NVIDIA devices; Vulkan needs /dev/dri. A graphics card installed in the server does not confirm GPU analytics when the container cannot access it.
Compatible models and a runtime must exist for the selected HW. Having CPU, CUDA, Jetson or Vulkan in a configuration alone does not establish minimum RAM or VRAM.
Before startup, estimate GPU memory as the sum of weights for all loaded model instances, peak working buffers and activations, frame and decoder buffers, driver overhead and selected reserve. Weight file size is not total consumption. Account for parallel workers: each may load its own models.
Measure the chosen model version:
- Measure occupied memory after startup and loading the required models, without cameras.
- Connect cameras with the intended resolution, frame rate and analysis settings. Measure steady consumption and peaks.
- Repeat at the target camera count with all required algorithms running together.
- Check that memory does not run out after warm-up, stream reconnection and maximum activity in the frame.
Measurement-based estimate:
GPU memory = models and persistent buffers
+ working buffers for all concurrently processed cameras
+ measured peak reserve
If unchanged settings produce an increase of m per camera, a preliminary estimate for N cameras is M₀ + N × m. M₀ is measured consumption without cameras. Verify this estimate at the target camera count: batching and shared buffers can change the relationship.
For NVIDIA devices, inspect utilization and memory with:
nvidia-smi
Measure GPU operation time after computation completes on the device: asynchronous launch does not measure the entire operation. Summing individual operation times estimates only sequential execution at a fixed batch size. Parallel execution streams and overlapping transfers and computation require a separate overall throughput measurement.
Also check processing speed and episode latency. Available GPU memory does not prove sufficient computation throughput for the chosen cameras.
RAM calculation for CPU analytics¶
With CPU processing, models and frames occupy server RAM. Measure persistent process consumption and the increase after connecting cameras with the site's intended settings.
Server RAM = OS and other services
+ inference and identification with models
+ frame and camera processing buffers
+ reserve for measured peaks
If analytics shares a server with a streamer, add video ingest and delivery, archive and operating buffers. Beside the management server, account for PostgreSQL, Redis and Watcher background jobs.
Check the system under load:
free -h
vmstat 1 10
Insufficient CPU can increase latency despite free memory. Check CPU capacity and analytics state alongside memory. Do not transfer fixed megabytes-per-camera values between model versions and devices without measuring again.
Service installation and computation options are described in analytics installation.