RidgeRun GStreamer Analytics Example: Heavy Processing

From RidgeRun Developer Wiki


Follow Us On Twitter LinkedIn Email Share this page





Example: Heavy Processing Monitored Through Metrics

Pipelines that rely heavily on software encoding often push CPUs to their limits. When utilization spikes, symptoms appear at multiple layers: system CPU usage climbs, the process itself consumes disproportionate resources, and pipeline throughput metrics like FPS and bitrate begin to degrade. Eventually, elements downstream may start dropping data or reporting errors.

Pipeline Under Load

The following pipeline drives a CPU-heavy scenario by encoding a 1080p60 stream in software using x264enc with a single thread. This configuration is intentionally inefficient to reproduce the type of stress test engineers often face in real deployments:

RR_PROC_NAME=performance-test \
GST_DEBUG="DEBUG" \
GST_REMOTE_DEBUG="DEBUG" \
GST_TRACERS="rrlogtracer;rrpipelineframerate;rrpipelinebitrate;rrpipelineruntime;rrprocmemusage;rrproccpuusage;rrprociousage" \
gst-launch-1.0 \
  videotestsrc is-live=true num-buffers=20000 \
  ! video/x-raw,format=I420,width=1920,height=1080,framerate=60/1 \
  ! queue max-size-buffers=0 max-size-time=0 max-size-bytes=0 \
  ! videoconvert \
  ! videoscale \
  ! x264enc tune=zerolatency speed-preset=medium threads=1 \
  ! queue \
  ! mpegtsmux \
  ! fakesink sync=true

Here’s how the environment variables and tracers make the analytics possible:

Table 1. Environment variables definition.
Variable Purpose
RR_PROC_NAME Sets the name under which the process will appear in Grafana.
GST_DEBUG Ensures rich circular logs are written locally on the device, capturing warnings or errors.
GST_REMOTE_DEBUG Defines what logs are sent remotely to Grafana Drilldown for analysis.
GST_TRACERS Enables reporting of FPS, bitrate, runtime, and per-process resource usage, making metrics visible in Grafana. Also enables the RidgeRun custom tracer (rrlogtracer) to capture and structure GStreamer logs.

Analysis in Grafana with RidgeRun GStreamer Analytics

When this pipeline runs, the RR Analytics dashboards make the cascade of events explicit:

  • System Metrics: CPU utilization spikes toward saturation, confirming the host is overcommitted.
    RidgeRun GStreamer Analytics CPU usage metrics
  • Per-Process Metrics: The performance-test process dominates CPU and shows a steady rise in memory usage.
    RidgeRun GStreamer Analytics memory usage metrics
  • Per-Pipeline Metrics: FPS begins to slip and bitrate declines, highlighting encoder strain.
    RidgeRun GStreamer Analytics bitrate and framerate analysis

With time-aligned visualizations, Grafana correlates the degradation with the CPU spike, making the failure point explicit.


Closing Remarks

In the heavy processing scenario, RidgeRun GStreamer Analytics makes it clear how system resource limits directly impact pipeline performance. Memory saturation is reflected in system and process metrics, while falling frame rates and declining bitrate are captured in per-pipeline measurements. Viewed together on Grafana dashboards, these signals provide an immediate picture of how excessive processing demands degrade throughput. This correlation helps engineers quickly identify bottlenecks, fine-tune workloads, and make informed decisions about scaling or hardware requirements.