Backend Development 12 min read

How 360 Media Gateway Handles Multi‑Protocol Streaming and High‑Concurrency

This article explains how the 360 media gateway supports various video sources, performs real‑time protocol conversion, uses caching and RingBuffer for efficient stream management, and demonstrates its high‑concurrency capabilities through extensive stress and latency tests.

360 Zhihui Cloud Developer
360 Zhihui Cloud Developer
360 Zhihui Cloud Developer
How 360 Media Gateway Handles Multi‑Protocol Streaming and High‑Concurrency

Business Background

360 media gateway connects various video sources, supports real‑time monitoring, live streaming and on‑demand playback, handling multiple protocols and efficient stream management to meet growing user demand and improve security and experience.

With IoT growth, more monitoring devices feed video into the gateway, which forwards streams to cloud or local servers for remote access, enhancing safety and response speed.

Live streaming demand rises in social media, online education, and gaming; the gateway supports RTMP, RTSP, WebRTC, and other protocols, delivering low‑latency, high‑definition streams for high‑concurrency scenarios.

On‑demand video is also supported by uploading files to the gateway for convenient playback.

Multi‑Protocol Support

The gateway supports RTSP, RTMP, HLS, HTTP‑FLV, WebRTC, each with distinct characteristics. Protocol conversion is achieved by abstracting incoming streams into a unified MediaSource object, then re‑packaging into the requested protocol without re‑encoding, preserving original H.264/AAC streams.

Conversion steps: media source abstraction, keep original encoding, manage conversion via MediaSourceMuxer, generate protocol‑specific MediaSource (e.g., FMP4MediaSource, RTMPMediaSource, etc.).

Low latency is maintained by avoiding re‑encoding, minimizing cache, and using multithreaded or asynchronous processing.

Efficient Media Stream Management

Caching is a key optimization. Each incoming stream creates a MediaSource cached in memory. On client request, the gateway checks the cache; a hit serves the stream directly, a miss pulls the source and caches it.

RingBuffer (circular buffer) stores audio/video frames, enabling multiple consumers to read concurrently without copying data, providing fast start and short‑term replay for new viewers.

RingBuffer also reduces memory allocation overhead and supports high‑throughput, low‑latency data delivery.

Performance Tests

Stress tests show the gateway can sustain 10,000 concurrent pull streams with 800% CPU and 80 MB memory; 20,000 streams use 1700% CPU and 170 MB; 30,000 streams reach CPU 2500% and 220 MB, indicating CPU is the limiting factor.

Latency tests reveal RTMP latency grows from 378 ms at 5,000 pulls to 8,503 ms at 30,000 pulls, confirming the system approaches its single‑node limit.

Key Advantages

High concurrency support.

Clustered deployment for scalability.

High performance via RingBuffer optimization.

Multi‑protocol compatibility.

Encrypted and private network support.

cachinghigh concurrencymedia streamingprotocol conversionmedia gateway
360 Zhihui Cloud Developer
Written by

360 Zhihui Cloud Developer

360 Zhihui Cloud is an enterprise open service platform that aims to "aggregate data value and empower an intelligent future," leveraging 360's extensive product and technology resources to deliver platform services to customers.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.