microsoft/garnet · error · Exception

SlowLogThreshold must be at least 100 microseconds.

Error message

SlowLogThreshold must be at least 100 microseconds.

What it means

Generic Exception thrown during Options.Initialize when SlowLogThreshold is set to a positive value less than 100 (microseconds). The slow log threshold must be either 0 (disabled) or at least 100 microseconds. Values between 1 and 99 are rejected because they would log nearly every command and are considered misconfiguration.

Source

Thrown at libs/host/Configuration/Options.cs:832

                    throw new Exception("RevivBinBestFitScanLimit must be >= 0.");
            }
            if (RevivifiableFraction != RevivificationSettings.DefaultRevivifiableFraction)
            {
                if (!hasRecordSizes && !enableRevivification)
                    throw new Exception("Revivification cannot specify RevivifiableFraction without specifying bins.");
            }

            // Warn users who explicitly opt into Scan compaction about the memory-spike cost.
            // Scan builds a temporary parallel KV index proportional to the keyspace; Lookup is the recommended alternative.
            if (CompactionType == LogCompactionType.Scan)
            {
                logger?.LogWarning("Compaction type Scan builds a temporary parallel KV index proportional to the keyspace, causing significant transient memory use. Use Lookup instead unless you have a specific reason for Scan.");
            }

            if (SlowLogThreshold > 0)
            {
                if (SlowLogThreshold < 100)
                    throw new Exception("SlowLogThreshold must be at least 100 microseconds.");
            }


            if (!EnableAOF.GetValueOrDefault())
            {
                if (!string.IsNullOrEmpty(AofSizeLimit))
                    throw new GarnetException("AofSizeLimit cannot be enforced with disabled AOF!");
            }

            Func<INamedDeviceFactoryCreator> azureFactoryCreator = () =>
            {
                if (!string.IsNullOrEmpty(AzureStorageConnectionString))
                {
                    return new AzureStorageNamedDeviceFactoryCreator(AzureStorageConnectionString, logger);
                }
                var credential = new ChainedTokenCredential(
                    new WorkloadIdentityCredential(),
                    new ManagedIdentityCredential(clientId: AzureStorageManagedIdentity)

View on GitHub (pinned to 951b0fc683)

Solutions

  1. Set SlowLogThreshold to 0 to disable the slow log, or to 100 or higher (in microseconds).
  2. Remember the unit is microseconds: 100 µs = 0.1 ms; for a 5 ms threshold use 5000.

Example fix

// before: user meant 50 ms but wrote 50 (microseconds)
options.SlowLogThreshold = 50;

// after: 50 ms in microseconds
options.SlowLogThreshold = 50000;
Defensive patterns

Strategy: validation

Validate before calling

void ValidateSlowLogThreshold(long threshold)
{
    // threshold is in microseconds; 0 disables, otherwise must be >= 100
    if (threshold != 0 && threshold < 100)
        throw new ArgumentOutOfRangeException(nameof(threshold), "SlowLogThreshold must be 0 (disabled) or >= 100 microseconds.");
}

Try / catch

try
{
    options.Initialize(logger);
}
catch (Exception ex) when (ex.Message.Contains("SlowLogThreshold"))
{
    logger.LogError("SlowLogThreshold must be 0 or >= 100 microseconds. Did you mean milliseconds? 50 ms = 50000.");
    throw;
}

Prevention

When it happens

Trigger: Setting --slowlog-threshold (SlowLogThreshold) to any value in the range 1–99 inclusive. Common when a user confuses microseconds with milliseconds and enters a small number expecting millisecond granularity.

Common situations: User sets SlowLogThreshold=50 thinking it means 50 ms (actually 50 µs); copying a threshold value from a system that uses different units; attempting to log everything by setting a very low threshold.

Related errors


AI-assisted analysis of microsoft/garnet@951b0fc683 (2026-08-13). Data as JSON: /api/errors/fb612fbf3c1b9a61. Report an issue: GitHub.