BrowserLab: Automated regression detection for the web

Visit the post for more.

Jeffrey Dunn
10 min readintermediate
--
View Original

Overview

BrowserLab is an automated system developed by Facebook to detect performance regressions in web applications, particularly focusing on client-side rendering. It aims to prevent regressions from being pushed to production by analyzing performance metrics with high accuracy, enabling engineers to optimize page load times effectively.

What You'll Learn

1

How to implement an automated regression detection system for web applications

2

Why isolating server noise is crucial for accurate performance testing

3

How to control for code non-determinism in performance testing

4

When to use an HTTP proxy for performance measurement

Prerequisites & Requirements

  • Understanding of web performance metrics and client-side rendering
  • Familiarity with WebDriver and Chrome tracing APIs(optional)

Key Questions Answered

How does BrowserLab detect performance regressions?
BrowserLab automatically analyzes the performance of every code change made by engineers at Facebook, catching regressions as small as 20 ms. It runs comparisons between the current production branch and trunk every two hours, applying change point analysis to identify performance issues.
What are the sources of noise in performance testing?
The main sources of noise identified include environmental factors such as hardware unpredictability, dynamic data content on Facebook, and code non-determinism. These factors can introduce variance in performance measurements, necessitating careful control to ensure accurate results.
What methods are used to ensure consistent data during testing?
To ensure consistent data, BrowserLab employs a backend proxy that caches request/response pairs, ensuring both control and treatment servers receive identical content. This approach prevents discrepancies caused by dynamic content changes during performance testing.
How does BrowserLab improve the accuracy of performance measurements?
BrowserLab improves accuracy by isolating client performance from server noise using an HTTP proxy, relocating browser directories to a RAM disk to reduce disk write variance, and launching fresh browser instances for each trial to maintain consistent state.

Key Statistics & Figures

Minimum detectable regression
20 ms
BrowserLab can catch regressions as small as 20 ms, which is critical for maintaining performance at Facebook's scale.
Performance improvement
over 350 ms
BrowserLab has helped engineers identify optimizations that have removed over 350 ms from every page load.
Confidence level in measurements
95 percent
The system allows for accurate measurement changes with a 95 percent confidence level across a set of 50 representative test users.

Technologies & Tools

Testing Tool
Webdriver
Used to automate browser interactions for performance testing.
Browser
Chrome
Used for running performance tests and collecting timing metrics.

Key Actionable Insights

1
Implementing an HTTP proxy can significantly enhance the accuracy of performance testing by isolating client performance from server noise.
This approach is particularly useful in environments where server performance can introduce variability, allowing for more reliable measurement of client-side rendering performance.
2
Controlling for code non-determinism is essential for accurate performance testing, especially in JavaScript-heavy applications.
By replacing random functions with deterministic versions, you can ensure consistent execution paths during tests, leading to more reliable performance metrics.
3
Regularly running automated regression detection can help catch performance issues early in the development cycle.
By integrating performance testing into the CI/CD pipeline, teams can prevent regressions from reaching production, maintaining a high-quality user experience.

Common Pitfalls

1
Failing to control for environmental noise can lead to inaccurate performance measurements.
Without isolating server and network noise, tests may reflect server performance issues rather than client-side rendering problems, leading to misguided optimizations.
2
Not accounting for dynamic content can skew performance results.
If the content served varies between test iterations, it can result in misleading performance metrics that do not accurately reflect the impact of code changes.

Related Concepts

Performance Optimization
Client-side Rendering
Automated Testing
Regression Detection