Documentation

Duration Units

Human-readable duration units for timeout and duration configuration values

Radiator Server supports human-readable duration units for all timeout and duration configuration values, making configuration files 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
        }
    }
}

Cache Expiration

caches {
    cache "user_sessions" {
        timeout 1h;  # Cache entries expire after 1 hour
    }

    cache "temp_data" {
        timeout 15m;  # Short-lived cache
    }
}

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 all timeout and duration configurations across the system:

  • Backend timeouts: HTTP, LDAP, and RADIUS backend server timeouts
  • Cache timeouts: Cache entry expiration times
  • Idle timeouts: RADIUS backend server idle connection timeouts
  • Custom timeout configurations: Any user-defined timeout values

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.