Abstract
Modern continuous deployment requires rapid, reliable canary testing to detect software regressions. Traditional fixed-sample tests are ill-suited for real-time monitoring due to the "peeking problem" and often overlook tail-end performance issues by focusing on mean shifts. We propose a framework for anytime-valid canary testing based on sequential tests of stochastic ordering. This approach enables continuous monitoring and automated stopping of defective deployments within seconds, while strictly controlling false positive rates.
Introduction
In continuous deployment environments, "canary testing" is the standard for risk mitigation, where a small fraction of traffic is routed to a new software version (treatment) to compare against the current version (control). However, traditional statistical methods face two primary challenges: the "peeking problem," where repeated observation of p-values inflates false positives, and the "average trap," where mean-based metrics fail to capture critical regressions in the distribution's tail (e.g., high-latency spikes).
Methodology: Sequential Stochastic Ordering
The proposed framework addresses these flaws through two core innovations: anytime-valid inference and stochastic dominance testing.
Anytime-Valid Inference
Instead of fixed-n tests, the framework utilizes confidence sequences. These provide a dynamic confidence band guaranteed to contain the true parameter at every time step. This allows for "optional stopping"—terminating a deployment the moment the confidence band excludes the null hypothesis—without compromising statistical integrity.
Stochastic Dominance
To move beyond simple mean comparisons, the framework tests for stochastic ordering. This checks every quantile of the distribution simultaneously, ensuring the new version is not worse for any segment of the user base. This approach captures non-linear performance impacts, such as when a bug creates a "heavy tail" of delays for a subset of users while leaving the median unchanged.
Evaluation and Results
The framework was evaluated using real-world Netflix canary data (latency and Successful Play Starts) and synthetic simulations comparing it against traditional Kolmogorov-Smirnov and Mann-Whitney U tests.
Rapid Detection
In a case study involving Successful Play Starts (SPS), the sequential test identified a critical regression in just 11.08 seconds. In contrast, traditional fixed-n methods typically require over 30 minutes of data to reach comparable confidence levels.
Reliability and Sensitivity
Simulations demonstrated that while traditional tests under continuous monitoring produced false positive rates as high as 64%, the sequential framework maintained its error guarantee with zero false positives. Furthermore, the system successfully detected a regression where the median latency increased by only 11ms, but the 75th percentile spiked by 51ms, highlighting its sensitivity to tail-end issues.
Discussion and Future Work
By defining an "approximate accept" threshold, the system can automatically conclude a test is safe and proceed with the rollout, reducing manual overhead. However, the model currently assumes stationarity in event distributions. Future work may explore sequential multinomial tests to better handle time-varying usage patterns, such as circadian rhythms, which can affect count metrics throughout the day.
Summary updated