Radiator Server Documentation — v10.33.2

Probabilistic Sampling

Use cases and patterns for probabilistic pipeline execution

Table of Contents
  • Common Use Cases
  • Request Sampling
  • Gradual Feature Rollout
  • Load Distribution
  • Performance Testing
  • Probability Formats
  • See Also

The sometimes action enables probabilistic execution of pipelines, useful for sampling, testing, and gradual feature rollouts.

Common Use Cases

Request Sampling

Collect detailed logs or metrics from a subset of requests to reduce overhead:

sometimes 10% {
    debug "User: %{aaa.identity} from %{radius.client.ip}";
} else {
    debug "Skipped detailed logging";
}

Use fine-grained ratios for rare event sampling:

# Sample 0.01% (1 in 10,000)
sometimes 1/10000 {
    backend "DETAILED_ANALYTICS";
}

Gradual Feature Rollout

Incrementally route traffic to new backends, starting small and increasing over time:

# Start with 5%, increase to 25%, then 50%, then 100%
sometimes 5% {
    backend "NEW_AUTH_BACKEND";
} else {
    backend "LEGACY_AUTH_BACKEND";
}

Load Distribution

Probabilistically distribute load across different backends:

accounting {
    sometimes 50% {
        backend "ACCOUNTING_SYSTEM_A";
        accept;
    } else {
        backend "ACCOUNTING_SYSTEM_B";
        accept;
    }
}

Performance Testing

Introduce artificial delays to simulate load:

sometimes 20% {
    sleep 100ms;  # Slow down 20% of requests
}

Probability Formats

Two main formats:

  • sometimes 50% - percentage notation
  • sometimes 1/2 - ratio format

The ratio format is needed for probabilities below 1%:

  • sometimes 1/1000 - 0.1%
  • sometimes 1/10000 - 0.01%

Note: Plain numbers without % (e.g., 50) are supported for backwards compatibility.

See Also

  • sometimes - Full action documentation
  • if - Conditional execution based on criteria
  • with - Execute pipeline with modified context
Navigation
  • About Radiator software development security

  • Architecture Overview

  • Backend Load Balancing

  • Basic Installation

  • Built-in Environment Variables

  • Comparison Operators

  • Configuration Editor

  • Configuration Import and Export

  • Data Types

  • Duration Units

  • Environment Variables

  • Execution Context

  • Execution Pipelines

  • Filters

  • Getting a Radiator License

  • Health check /live and /ready

  • High Availability and Load Balancing

  • High availability identifiers

  • HTTP Basic Authentication

  • Introduction

  • Linux systemd support

  • Local AAA Backends

  • Log storage and formatting

  • Management API privilege levels

  • Namespaces

  • Password Hashing

  • Pipeline Directives

  • Probabilistic Sampling

  • Prometheus scraping

  • PROXY Protocol Support

  • Radiator server health and boot up logic

  • Radiator sizing

  • Radiator software releases

  • Rate Limiting

  • Rate Limiting Algorithms

  • Reverse Dynamic Authorization

  • Service Level Objective

  • TACACS+ Authentication, Authorization, and Accounting

  • Template Rendering CLI

  • Tools radiator-client

  • TOTP/HOTP Authentication

  • What is Radiator?

  • YubiKey Authentication

  • YubiKey Context Variables