Operations 20 min read

Baidu Test Middleware: Architecture, Design Principles, and Application Scenarios

The article introduces Baidu's self‑developed test middleware, explains its data‑plane and control‑plane architecture inspired by Istio, describes the challenges of building test environments, and details the system’s components, working modes, and diverse testing use cases such as functional, system, integration, sandbox, and chaos engineering.

Baidu Intelligent Testing
Baidu Intelligent Testing
Baidu Intelligent Testing
Baidu Test Middleware: Architecture, Design Principles, and Application Scenarios

1. What is Baidu Test Middleware

Baidu Test Middleware is a network‑proxy based infrastructure developed by Baidu QA over ten years, adopting a data‑plane + control‑plane architecture similar to Google Istio. It intercepts module communication, enabling data parsing, modification, routing, circuit‑breaking, filtering, and rate‑limiting to support a wide range of testing scenarios.

2. Challenges in Test Environments

Traditional integration testing requires building full topologies for each test, leading to high resource consumption and long setup times. Maintaining a baseline environment for multiple projects causes stability issues, while resource‑intensive multi‑tenant setups reduce efficiency.

3. Design Approach

The middleware abstracts testing needs into link‑level data and behavior controls, providing a reusable routing capability that isolates test traffic and a flexible simulation mechanism for network anomalies.

3.1 System Composition

Application Platform: Exposes API‑based services that translate user requests into configuration entries.

Configuration Center (Control Plane): Stores structured policies and watches for changes, built on Zookeeper.

Middleware Proxy (Data Plane): Implemented in C++, watches the configuration center, and performs real‑time traffic interception, routing, recording, and mock.

Data Center: Persists recorded request/response pairs in Redis using composite keys (task + link + request).

Log Center: Centralizes logs from distributed proxy instances.

Control Center: Issues per‑instance commands for debugging or operational adjustments.

3.2 Working Modes

Cluster Mode: Remote cluster of identical proxy instances; suitable for latency‑insensitive tests (functional, diff, stable).

Local Mode: Sidecar deployment alongside the tested module; provides near‑zero latency for performance‑sensitive or chaos tests.

3.3 Overall Workflow

Service request: User describes test needs via the application platform or API.

Link generation: Configuration center creates policies; proxies load them and establish corresponding middleware links.

Link takeover: Environment tools discover middleware link addresses and route upstream modules through them.

Policy execution: Requests traverse middleware; matching policies (routing, recording, modification) are applied; otherwise traffic is forwarded unchanged.

4. Application Scenarios

4.1 Functional Testing

Creates mock links to simulate stable or abnormal backend responses using AUTO, DATAID, CALL_BACK, and USER_DEFINE modification strategies.

4.2 System‑Level Testing

Records baseline traffic, stores it in the data center, and replays it to provide deterministic backend mocks for diff analysis.

4.3 Integration Testing

Reuses a single baseline environment, routing specific requests to different downstream modules via middleware, achieving high resource efficiency.

4.4 Sandbox Testing

Combines traffic simulation, environment replication, and rapid provisioning to create high‑fidelity offline testbeds.

4.5 Chaos Engineering

Deploys middleware as sidecars to inject precise request‑level failures (circuit‑break, filter, rate‑limit) without affecting non‑targeted traffic.

5. Technical Ecosystem

The middleware now serves multiple Baidu product lines, covering nine major testing scenarios and abstracting them into eight atomic capabilities, forming a virtuous cycle of product adoption and technical improvement.

6. Core Essence

From a simple proxy to a full‑stack testing environment component, the middleware integrates data‑plane traffic control with a powerful control plane, becoming an inseparable part of Baidu’s testing infrastructure.

testingMiddlewareperformance testingChaos Engineeringservice meshenvironment automation
Baidu Intelligent Testing
Written by

Baidu Intelligent Testing

Welcome to follow.

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.