A Scalable WebRTC Media Streaming Server
This repository contains the source code for our CCNC '26 paper:
Janus Streamer: A Scalable WebRTC Media Streaming Server Jaehyeong Park, Seongyeop Jeong, Seung Min Kim, Jin-Soo Kim 2026 IEEE 23rd Consumer Communications & Networking Conference (CCNC)
Janus Streamer is an enhanced version of Janus Gateway designed to address scalability limitations in high-load streaming environments. While Janus Gateway's modular architecture separates core and plugin threads via a producer-consumer model, this design incurs significant overhead from queue manipulation, memory management, and context switching as client counts increase.
Janus Streamer introduces a direct packet transmission interface that allows plugin threads to send RTP packets directly to clients, bypassing the core event-loop. Combined with additional optimizations, Janus Streamer achieves:
- 3.6x throughput improvement (up to 90 Gbps on 40 CPU cores)
- 37% reduction in CPU usage
- 3.1x - 5.7x throughput improvement on a single CPU core (depending on bitrate)
- Comparable Quality of Experience (QoE) to baseline Janus Gateway
| Feature | Description |
|---|---|
| Direct Packet Transmission | New relay_rtps interface enables plugins to transmit RTP packets directly, eliminating queue-based overhead |
| sendmmsg | Batch multiple UDP packets in a single system call to reduce syscall overhead |
| UDP GSO (Generic Segmentation Offload) | Merge RTP packets into larger datagrams for efficient NIC-level segmentation |
| CPU Affinity | Pin helper threads to specific CPU cores to avoid cache-line contention |
┌─────────────────────────────────────────────────────────────────┐
│ Janus Streamer │
├─────────────────────────────────────────────────────────────────┤
│ ┌─────────────────┐ ┌─────────────────────────────────────┐ │
│ │ Streaming Plugin│ │ Core │ │
│ │ ┌───────────┐ │ │ ┌─────────┐ ┌───────────────┐ │ │
│ │ │ Relay │──┼────┼─>│ Queue │───>│ Event-loop │ │ │
│ │ │ Thread │ │ │ └─────────┘ │ Thread │ │ │
│ │ └───────────┘ │ │ └───────┬───────┘ │ │
│ │ ┌───────────┐ │ │ │ │ │
│ │ │ Helper │──┼────┼─────────────────────────┼───────────┼─┼──> Client
│ │ │ Threads │ │ │ Direct Transmission │ │ │ (RTP)
│ │ └───────────┘ │ │ (New Data Plane) v │ │
│ └─────────────────┘ │ ┌───────────────┐ │ │
│ │ │ Socket │───┼─┼──> Client
│ │ └───────────────┘ │ │ (RTCP)
│ └─────────────────────────────────────┘ │
└─────────────────────────────────────────────────────────────────┘
───────> RTP (Direct) - - - -> RTCP (via Event-loop)
janus-streamer/
├── src/
│ ├── janus.c/h # Core server implementation
│ ├── ice.c/h # ICE/DTLS/WebRTC handling (modified for GSO/sendmmsg)
│ ├── plugins/
│ │ ├── janus_streaming.c # Streaming plugin (modified for direct transmission)
│ │ └── ...
│ ├── transports/ # Transport plugins (HTTP, WebSocket, etc.)
│ └── events/ # Event handler plugins
├── conf/ # Configuration file samples
├── test/ # Test scripts (aiortc-based)
└── html/ # Web demo files
- 1-socket x86_64 CPU (40 cores, Intel Xeon Gold 5218R)
- Mellanox ConnectX-5 100GbE NIC
- Linux kernel version: 5.4.0 or later (for UDP GSO and sendmmsg support)