Core Concepts

Percentage Rollouts

2 min read

Percentage Rollouts let you release a feature to a specific fraction of your users. FlagPilot calculates evaluations client-side in under 1 ms using a sticky, deterministic hash function — ensuring each user has a consistent experience without database round-trips.

Deterministic Hashing Algorithm

To allocate users to rollout buckets, the SDK hashes the user ID combined with the feature flag key using SHA-256. Taking the first 8 hex characters of the hash, parsing it as an integer, and applying a modulo 100 operation maps the user to a sticky bucket number between 0 and 99:

hashing.ts
function getRolloutBucket(userId: string, flagKey: string): number {
  const hash = sha256(`${userId}:${flagKey}`);
  const first8Hex = hash.substring(0, 8);
  const intValue = parseInt(first8Hex, 16);
  return intValue % 100;
}

If the calculated bucket number is strictly less than the target rollout percentage, the flag evaluates to true. For example, with a 20% rollout, buckets 0 through 19 receive the feature, while buckets 20 through 99 do not.

Step-by-Step Evaluation Lifecycle

When evaluating a feature flag, the SDK runs the following logic sequence:

1. Toggle State: Is the flag turned on in the environment?
2. Target Users: Is the user ID explicitly forced ON?
3. Hashing Bucket: Does the deterministic hash value fall in the rollout range?
4. Fallback Default: Serve default inactive configuration.

FAQ

How does Percentage Rollouts interact with local caches?

Configurations are synced down using Edge Config or fallback REST triggers. The client automatically reads evaluations in-memory, resulting in sub-millisecond local evaluation times.

Where can I obtain support for Percentage Rollouts?

You can open a support ticket in your dashboard, check the community roadmap, or consult the FlagPilot Platform Status page.

Was this page helpful?