Radiator Server Documentation — v10.33.1

Duration Units

Human-readable duration units for timeout, interval, and delay values

Radiator Server supports human-readable duration units across timeout, interval, and delay settings, making configuration files and tool invocations more readable and maintainable.

Overview

Duration values can be specified using intuitive unit suffixes instead of raw millisecond values.

Supported Units

UnitDescriptionEquivalent (base)
msMilliseconds0.001 seconds
sSeconds1000 milliseconds
mMinutes60 seconds
hHours60 minutes (3600 seconds)
dDays24 hours
wWeeks7 days
MMonths30 days (fixed length)
yYears365 days (fixed length)

Note: Months and years use fixed lengths and are not calendar-aware. A month is always 30 days, and a year is always 365 days (no leap year adjustment).

Basic Usage

Simple Duration Values

backends {
    radius "upstream" {
        server "192.168.1.10" {
            timeout 5s;        # 5 seconds
            idle_timeout 30m;  # 30 minutes
        }
    }
}

Combined Duration Values

You can combine multiple units for precise duration specifications:

backends {
    http "api" {
        url "https://api.example.com";
        timeout 1m30s;  # 1 minute and 30 seconds (90 seconds total)
    }

    ldap "directory" {
        server "ldap.example.com" {
            url "ldap://ldap.example.com:389/";
            timeout 2h30m;  # 2 hours and 30 minutes
        }
    }
}

Where Duration Units Apply

Duration units are supported in many timeout, interval, and delay settings across the system, including:

  • Backend timeouts: HTTP, LDAP, and RADIUS backend server timeouts
  • Cache timeouts: Cache entry expiration times
  • Idle timeouts: RADIUS backend server idle connection timeouts
  • Statistics intervals: statistics interval values for defaults, counters, and histograms
  • Certificate directory refresh: x509-directory interval values for CA directory rescans
  • radiator-test scenario limits: scenario.toml timeout_seconds and max_duration_seconds
  • radcheck retry delays: --delay values such as 100ms and 1s

Context-Specific Defaults

When a value is written without a suffix, the default unit depends on the setting:

  • Most .radconf duration settings, including statistics interval and x509-directory interval, treat plain numbers as milliseconds.
  • radiator-test scenario.toml keys timeout_seconds and max_duration_seconds treat plain numbers as seconds for backward compatibility.
  • radcheck --delay treats plain numbers as milliseconds for backward compatibility.

Tool Examples

radiator-test scenario.toml supports the same duration syntax:

timeout_seconds = "30s"
max_duration_seconds = "2m"

radcheck retry delays also accept duration strings:

radcheck --delay 250ms contains radiator-server.log -s "Server started"

Best Practices

  1. Use appropriate units: Choose the most natural unit for your use case

    • Short timeouts: use seconds (5s, 30s)
    • Medium timeouts: use minutes (5m, 30m)
    • Long timeouts: use hours or days (2h, 1d)
  2. Combine units for clarity: 1m30s is clearer than 90s for some contexts

  3. Be consistent: Use similar unit patterns across your configuration for readability

Error Handling

Invalid unit suffixes will result in configuration parsing errors with helpful messages indicating the supported units and correct syntax.