Files
nexus/wiki/concepts/Feature-Flag.md
2026-04-16 17:30:41 +08:00

1.2 KiB
Raw Blame History

title, type, tags, sources, last_updated
title type tags sources last_updated
Feature Flag concept
持续交付
特性管理
发布工程
https://launchdarkly.com/blog/rto-vs-rpo/
2025-07-26

Definition

Feature Flag特性开关是一种将代码部署与功能发布分离的技术允许在不重新部署的情况下通过配置切换代码执行路径。

Key Concepts

  • Deploy != Release部署代码但不立即向用户开放
  • Kill Switch紧急关闭机制用于快速禁用问题功能
  • 渐进式 Rollout分阶段向用户群发布1% → 5% → 25% → 100%

Benefits for RTO/RPO

  • RTO从小时级降至秒级只需关闭开关
  • RPORollback 时不丢失数据,只需切换代码路径

Code Example

if (featureFlag.enabled('new-checkout-flow')) {
  return newCheckoutProcess();
} else {
  return oldCheckoutProcess();
}

Connections