惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

T
Threatpost
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
S
Security Affairs
N
News and Events Feed by Topic
T
Tenable Blog
P
Proofpoint News Feed
W
WeLiveSecurity
Simon Willison's Weblog
Simon Willison's Weblog
Google DeepMind News
Google DeepMind News
C
CERT Recently Published Vulnerability Notes
Help Net Security
Help Net Security
I
Intezer
T
Threat Research - Cisco Blogs
S
Secure Thoughts
C
Cyber Attacks, Cyber Crime and Cyber Security
L
Lohrmann on Cybersecurity
AWS News Blog
AWS News Blog
Google Online Security Blog
Google Online Security Blog
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
Know Your Adversary
Know Your Adversary
Project Zero
Project Zero
The Hacker News
The Hacker News
Security Archives - TechRepublic
Security Archives - TechRepublic
T
Tor Project blog
N
News | PayPal Newsroom
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
Hacker News - Newest:
Hacker News - Newest: "LLM"
A
Arctic Wolf
Forbes - Security
Forbes - Security
O
OpenAI News
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
Security Latest
Security Latest
P
Palo Alto Networks Blog
S
Schneier on Security
S
Securelist
C
Cybersecurity and Infrastructure Security Agency CISA
H
Heimdal Security Blog
V
Vulnerabilities – Threatpost
www.infosecurity-magazine.com
www.infosecurity-magazine.com
博客园_首页
T
Troy Hunt's Blog
Latest news
Latest news
Recent Announcements
Recent Announcements
MyScale Blog
MyScale Blog
人人都是产品经理
人人都是产品经理
L
LINUX DO - 热门话题
M
MIT News - Artificial intelligence
N
Netflix TechBlog - Medium
V
Visual Studio Blog
H
Hacker News: Front Page

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant Common SOC 2 Failures (Real World) Stop Vibe-Checking Your AI App: A Practical Guide to Evals How to Use SonarQube and SonarScanner Locally to Level Up Your Code Quality Your Next To-Do App Is Dead — I Replaced Mine with an OpenClaw AI Sign a Nostr event in 60 lines of Python using coincurve — no nostr-sdk, no nbxplorer, no rust toolchain ITGC Audit Explained Like You’re in Big 4 Patch Tuesday abril 2026: Microsoft parcha 163 vulnerabilidades y un zero-day en SharePoint Stop scraping everything: a better way to track competitor price changes Listing on MCPize + the Official MCP Registry while routing payments OUTSIDE the marketplace — how I kept 100% of my x402 revenue Building an AI-Powered Risk Intelligence System Using Serverless Architecture Why We Ripped Function Overloading Out of Our AI Toolchain Testing AI-Generated Code: How to Actually Know If It Works SaaS Churn Is Killing Your Business. Here Is What to Do About It (Without a Support Team) The Speed of AI Is No Longer Linear - And Self-Improving Models Are Why How to Implement RBAC for MCP Tools: A Practical Guide for Engineering Teams From Standard Quote to Persuasive Proposal: AI Automation for Arborists I built a CLI that scaffolds complete multi-tenant SaaS apps Axios CVE-2025–62718: The Silent SSRF Bug That Could Be Hiding in Your Node.js App Right Now The dashboard that ended our friendship Data Pipelines Explained Simply (and How to Build Them with Python) The Hidden Cost of AI Systems Nobody Talks About. undefined vs undeclared, and how typeof behaves Switching from file-based jobs to NATS/Kafka in Rust without changing code io_uring Adventures: Rust Servers That Love Syscalls Why Agentic AI is Killing the Traditional Database The POUR principles of web accessibility for developers and designers Quantum Neural Network 3D — A Deep Dive into Interactive WebGL Visualization How To Install Caveman In Codex On macOS And Windows Automation Pipeline Reliability: Why Your Workflow Breaks When Nobody Is Watching I Built an 'Open World' AI Coding Agent — It Works From ANY Folder From Freelancing to Product: A Tech Service Company's SaaS Transformation China's AI Giants: Adding Tencent Hunyuan & ByteDance Doubao to AI University (74 Providers) On the Vibe Coders and Their Lies clerk: Auto-Summarize Your Claude Code Sessions AI Weekly — 2026/04/10–04/17 | The Model Lockdown Is Here, but the Toolchain Is the Real Battleground AI 週報 — 2026/04/10–2026/04/17 模型封鎖潮來了,但工具鏈才是真戰場 Maybe this is how Open-Source apps are born... 🚀 Fine-Tune LLMs with LoRA and QLoRA: 2026 Guide tRPC v11 + Next.js App Router: End-to-End Type Safety Without the Boilerplate ShadCN UI in 2026: Why I Stopped Installing Component Libraries and Started Owning My Components SaaS Billing in React Server Components: Stripe + Supabase Without a Single `useEffect` Join our DEV Weekend Challenge — $1,000 in Prizes Across TEN winners! Submissions Due April 20 at 6:59 AM UTC. Implementing FSRS Spaced Repetition in Flutter + Supabase — Adding Memory Science to an AI Learning App "I Texted My Localhost From the Train — Claude Code Fixed the Bug Before I Got Home" I Built a Sales Prep AI and It Went Deeper Than Expected Design to Code #2: One JSON, Eleven Outputs Solving the 100M-Row Problem: A Summary Table Pattern for High-Volume Push Notification Logs Flutter Web With Wasm: What Actually Changes For Developers I Built 50 Royalty-Free Soundtracks for My Side Project in a Weekend Using AI Music Generation The Vibe Coding Security Checklist: 7 Things to Check Before You Ship Stop Letting Googlebot Guess Fix Your React App's SEO Right Desconstruindo o Streaming do LinkedIn: Como Criar um Engine de Extração de Vídeo de Alta Performance com HLS e FFmpeg (EDA Part-1) EDA (Exploratory Data Analysis) Explained With Real Life — Why Looking at Your Data Is the Most Important Step in Machine Learning Brand Relationship Management at Scale: Our 4-Touch Outreach System for 200+ Brands Why String.fromEnvironment() Might Return an Empty String in Dart JGuardrails 1.0.0 — Hardening Java LLM Apps Against Jailbreaks, Toxicity, and Prompt Injection Plan and Schedule a Full Week of Threads Content From One Claude Conversation Coding Cat Oran Ep3, Five Tables Changed Everything Updated: BFF Pattern I'm done watching freelancers get buried by 200 proposals. So I'm building the alternative. This is my first post BFS Algorithm in Java Step by Step Tutorial with Examples Tracking LLM Pricing Monthly: An Open Dataset for 22 AI Models How We Measure Content ROI on a Comparison Site: Revenue Attribution Without Perfect Data Introducing Nova AI Ops: The AI-Native Operating System for SRE Teams I built a free desktop video downloader for Windows — Grabbit How Talkie OCR Helps Vision-Impaired & Dyslexic Users Read the World Around Them VRCFaceTracking安装和iPhone面捕配置教程,有bug Even CrowdStrike Can't See Your Agents The Automation Gold Rush: What n8n Workflows and Claude Are Opening Up for Developers Right Now
A/B Testing with Feature Flags: Ship Experiments Without the Complexity
Domenico Gio · 2026-05-02 · via DEV Community

This was originally published on rollgate.io/blog/ab-testing-feature-flags.

Why A/B Test with Feature Flags?

Most teams think A/B testing requires a dedicated experimentation platform — Optimizely, LaunchDarkly Experimentation, or Google Optimize (RIP). These tools cost thousands per month, add SDK bloat, and introduce yet another vendor into your stack.

Here's the thing: if you already have feature flags, you already have 80% of what you need for A/B testing.

A feature flag with percentage-based rollout is fundamentally an A/B test. The only missing pieces are:

  1. Consistent assignment — same user always sees the same variant
  2. Variant tracking — recording which variant each user saw
  3. Metric collection — measuring outcomes per variant
  4. Statistical analysis — determining if the difference is real

Let's build this step by step.

The Basics: Flags as Experiments

A traditional feature flag splits users into two groups: flag ON vs flag OFF. An A/B test does the same thing, but with intent — you're measuring which group performs better on a specific metric.

// This is a feature flag
const showNewPricing = rollgate.isEnabled('new-pricing-page', { userId });

// This is also an A/B test
// Same code, different intent
if (showNewPricing) {
  renderNewPricingPage(); // Variant B
  track('pricing_page_view', { variant: 'new' });
} else {
  renderCurrentPricingPage(); // Variant A (control)
  track('pricing_page_view', { variant: 'control' });
}

Enter fullscreen mode Exit fullscreen mode

The code is identical. The difference is operational: you're tracking outcomes and making a data-driven decision.

Consistent User Assignment

The most important requirement for A/B testing is consistency — a user must always see the same variant for the duration of the experiment. If user #42 sees the new pricing page on Monday, they must see it on Tuesday too.

Feature flags handle this through sticky assignment. When you pass a userId (or any stable identifier) to the flag evaluation, the system hashes it deterministically:

// Rollgate SDK handles this automatically
const variant = rollgate.isEnabled('new-pricing-page', {
  userId: user.id, // Stable identifier
});

// Same userId always gets the same result
// No database lookup, no cookie required

Enter fullscreen mode Exit fullscreen mode

This works because good feature flag systems use consistent hashing (like MurmurHash) on the user ID. The hash maps to a number between 0-100, and if your rollout is at 50%, users with hash < 50 get the variant, others get the control.

Why this matters: Cookie-based assignment breaks across devices. Server-side hashing on user ID works everywhere — web, mobile, API, email.

Designing Your Experiment

Before writing code, define three things:

1. Hypothesis

Bad: "Let's see if the new pricing page is better."

Good: "Changing the pricing page CTA from 'Start Free Trial' to 'Get Started Free' will increase trial signups by at least 10%."

A clear hypothesis tells you what to measure and when to stop.

2. Primary Metric

Pick one metric that determines success. Secondary metrics are fine for context, but having multiple primary metrics inflates your false positive rate.

Experiment Bad Primary Metric Good Primary Metric
New checkout flow Page views Completed purchases
Pricing page redesign Time on page Trial signups
Search algorithm Searches performed Click-through on first result

3. Sample Size

This is where most teams mess up. You need enough data to detect a meaningful difference. Running an experiment for 2 days with 100 users proves nothing.

Rule of thumb for a standard A/B test:

  • 5% conversion rate baseline → need ~1,500 users per variant to detect a 20% relative change
  • 2% conversion rate baseline → need ~4,000 users per variant
  • High-traffic pages → you might have enough data in days
  • Low-traffic pages → it might take weeks

Don't stop the experiment early because one variant "looks better." That's the statistical equivalent of flipping a coin 5 times, getting 4 heads, and concluding the coin is biased.

Implementation Pattern

Here's a practical implementation using feature flags:

Step 1: Create the Flag

Set up a boolean feature flag with percentage-based rollout:

  • Flag name: experiment-pricing-cta
  • Rollout: 50% (half see variant B, half see control)
  • Targeting: All logged-in users

Step 2: Instrument Your Code

// Server-side (Node.js example)
app.get('/pricing', async (req, res) => {
  const showNewCTA = rollgate.isEnabled('experiment-pricing-cta', {
    userId: req.user.id,
  });

  // Track exposure
  analytics.track('experiment_exposure', {
    experiment: 'pricing-cta',
    variant: showNewCTA ? 'new-cta' : 'control',
    userId: req.user.id,
  });

  res.render('pricing', { showNewCTA });
});

Enter fullscreen mode Exit fullscreen mode

// Client-side (React example)
function PricingPage() {
  const showNewCTA = useFlag('experiment-pricing-cta');

  useEffect(() => {
    analytics.track('experiment_exposure', {
      experiment: 'pricing-cta',
      variant: showNewCTA ? 'new-cta' : 'control',
    });
  }, [showNewCTA]);

  return (
    <div>
      <h1>Choose your plan</h1>
      <Button onClick={handleSignup}>
        {showNewCTA ? 'Get Started Free' : 'Start Free Trial'}
      </Button>
    </div>
  );
}

Enter fullscreen mode Exit fullscreen mode

Step 3: Track Conversions

// When the target action happens
function handleSignup(plan) {
  analytics.track('trial_signup', {
    experiment: 'pricing-cta',
    variant: rollgate.isEnabled('experiment-pricing-cta', { userId })
      ? 'new-cta'
      : 'control',
    plan: plan,
  });
}

Enter fullscreen mode Exit fullscreen mode

Step 4: Analyze Results

After reaching your target sample size, pull the data:

-- Conversion rate per variant
SELECT
  variant,
  COUNT(DISTINCT user_id) as users,
  COUNT(DISTINCT CASE WHEN converted THEN user_id END) as conversions,
  ROUND(
    COUNT(DISTINCT CASE WHEN converted THEN user_id END)::numeric /
    COUNT(DISTINCT user_id) * 100, 2
  ) as conversion_rate
FROM experiment_events
WHERE experiment = 'pricing-cta'
GROUP BY variant;

Enter fullscreen mode Exit fullscreen mode

variant users conversions conversion_rate
control 12,847 411 3.20%
new-cta 12,903 658 5.10%

A 59% relative improvement looks great — but is it statistically significant? Use a chi-squared test or an online calculator. At these numbers, p < 0.001 — this is a real effect, not noise.

Multi-Variant Tests (A/B/n)

Sometimes you want to test more than two variants. Feature flags support this through string variants instead of boolean on/off:

// Flag returns a string variant instead of boolean
const ctaVariant = rollgate.getVariant('experiment-pricing-cta', {
  userId: user.id,
});

// ctaVariant could be: 'control', 'free-trial', 'get-started', 'try-now'
const ctaText = {
  'control': 'Start Free Trial',
  'free-trial': 'Try Free for 14 Days',
  'get-started': 'Get Started Free',
  'try-now': 'Try Now — No Card Required',
}[ctaVariant];

Enter fullscreen mode Exit fullscreen mode

Warning: More variants means more traffic needed. With 4 variants, you need roughly 4x the sample size of a simple A/B test to reach significance.

Common Pitfalls

1. Peeking at Results Too Early

Looking at experiment data daily and stopping when you see significance is called optional stopping, and it dramatically inflates false positives. Set your sample size upfront and wait.

If you absolutely must peek, use sequential testing methods that account for multiple looks at the data.

2. Running Too Many Experiments Simultaneously

If experiments overlap (same user is in multiple experiments), interactions between them can pollute your results. Keep concurrent experiments on different parts of the product, or use mutually exclusive experiment groups.

3. Not Accounting for Novelty Effect

Users often engage more with anything new simply because it's new. A new UI might show higher engagement in week 1 that drops off by week 3. Run experiments long enough to capture steady-state behavior — typically 2-4 weeks.

4. Survivorship Bias

If your experiment only measures users who reach a certain point (e.g., checkout), you're missing the users who dropped off earlier. Always measure from the point of exposure, not from the point of conversion.

5. Ignoring Segments

An experiment might show no overall effect but have a strong positive effect on mobile users and a negative effect on desktop users. Check segment-level results for:

  • Device type (mobile vs desktop)
  • New vs returning users
  • Geography
  • Plan tier

When NOT to A/B Test

Not everything needs an experiment:

  • Bug fixes — just fix them
  • Legal/compliance changes — not optional
  • Performance improvements — measure, don't A/B test
  • Changes with < 1,000 weekly users exposed — you won't reach significance in a reasonable time
  • Obvious improvements — if the old version is clearly broken, skip the test

A/B testing is for decisions where the answer isn't obvious and the stakes justify the effort.

Feature Flags vs Dedicated A/B Testing Platforms

Capability Feature Flags Dedicated Platform
Traffic splitting Yes Yes
Consistent assignment Yes Yes
Multi-variant support Yes Yes
Built-in analytics Basic Advanced
Statistical engine DIY or basic Built-in
Bayesian analysis No (usually) Yes
Visual editor No Yes
Price $0-99/mo $1,000-10,000+/mo

Use feature flags when you run < 10 experiments per month, have engineers who can write code for variants, and want to keep your stack simple.

Use a dedicated platform when experimentation is a core competency, you run dozens of concurrent experiments, and you need non-engineers to create tests.

For most teams under 50 engineers, feature flags are more than enough.

Getting Started

Here's a practical checklist for your first A/B test with feature flags:

  1. Pick a high-traffic page where you can reach sample size in 1-2 weeks
  2. Define your hypothesis and primary metric before writing code
  3. Calculate sample size using an online calculator
  4. Create a flag with 50% rollout and user-based targeting
  5. Instrument exposure and conversion events in your analytics
  6. Wait for full sample size — don't peek and stop early
  7. Analyze results and document the decision
  8. Clean up — roll the winner to 100% and remove the flag

The best part? If you're already using feature flags for releases, you already have the infrastructure. You just need to add tracking and discipline.


Rollgate supports percentage-based rollouts with consistent user assignment out of the box — everything you need to run A/B tests without adding another vendor to your stack. Get started free.


Related reading: Learn the fundamentals in What Are Feature Flags?, see how to implement gradual rollouts step by step, or check out our SDK tutorials for React, Next.js, and Python. For pricing across platforms, see our feature flags pricing comparison.