Operations 7 min read

Extending Mahimahi Record‑and‑Replay Framework to Support HTTP/2 and QUIC with Nginx

The authors upgraded the Mahimahi record‑and‑replay framework by replacing Apache with modular Nginx, adding native HTTP/2 support and integrating a QUIC module (via quiche), enabling replay of captured traffic under modern protocols, precise network condition control and open‑sourcing the extensions for reproducible performance experiments.

Bilibili Tech
Bilibili Tech
Bilibili Tech
Extending Mahimahi Record‑and‑Replay Framework to Support HTTP/2 and QUIC with Nginx

In today’s ecosystem, services that rely on the HTTP protocol are ubiquitous, and the performance of HTTP directly impacts user experience and service quality. As HTTP evolves—through version updates, congestion‑control improvements, and new transport protocols—developers need reliable ways to debug and evaluate network services.

Record‑and‑Replay is an effective technique for debugging and performance analysis. The MIT project Mahimahi provides a user‑space toolset for network emulation that can record HTTP traffic from applications and replay it under simulated network conditions for accurate measurement.

Mahimahi offers two core shells: RecordShell captures real HTTP requests and responses to local storage, and ReplayShell replays the recorded traffic in an offline environment. It also supplies three simulation shells— DelayShell (fixed latency), LinkShell (fixed/variable bandwidth), and LossShell (random packet loss)—which can be combined or nested to create flexible experiment scenarios.

The original implementation forwards recorded traffic through an Apache server and only supports HTTP/1.1 and SPDY. It lacks QUIC support, and both SPDY and Apache are now outdated, while modern sites predominantly use HTTP/2 and QUIC (HTTP/3). Consequently, the project needed extensions to handle newer protocols.

We replaced the Apache server with Nginx because of its modular architecture. Nginx natively supports the HTTP/2 module, and we integrated the Nginx QUIC Module (and Bilibili’s custom QUIC stack) to add H3/QUIC support. This modular approach allows each protocol to be compiled as an independent module and loaded dynamically via configuration files. Additional enhancements include support for more HTTP request methods and the use of self‑signed certificates for TLS testing.

For experimental validation, we recorded the full playback of a Bilibili video page using RecordShell , which captured traffic over HTTP/1.1. The recorded trace was then replayed under both HTTP/2 and QUIC conditions. The results—illustrated with screenshots—showed the impact of protocol choice on page load time and demonstrated the ability to control variables precisely (e.g., adding 100 ms latency to video‑resource flows). The record‑and‑replay workflow enables a single capture to be reused across multiple experiments, improving reproducibility.

To facilitate broader adoption, we open‑sourced the extended tool at https://github.com/bilibili/mahimahi . The QUIC module and its underlying library, quiche, are also available at https://github.com/bilibili/quiche . Future work will continue to explore deeper QUIC experiments and further protocol extensions.

HTTPNginxQUICMahimahinetwork testingprotocol simulationrecord-and-replay
Bilibili Tech
Written by

Bilibili Tech

Provides introductions and tutorials on Bilibili-related technologies.

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.