Skip to content

Version 2 Configuration Keys

Chris Lewis edited this page Apr 19, 2018 · 2 revisions

IMPORTANT This is documentation for versions 2.x and earlier. For the newest version see: Configuration

The configuration must be initialized on application start. See Installing and Configuring.

Configuring Timeouts

See also Timeouts and Cancellation.

  • Per-Command Timeout - Timeouts are configurable per-command. See Command Names to understand how the command-name component is generated from the Command's group and class name.

    command.<command-name>.Timeout=2000
    

    Example: A Command class called FileExistsInS3Command with the command group s3 would use the configuration:

    command.s3.FileExistsInS3.Timeout=2000
    
  • Global Ignore - Timeouts can be globally ignored. Only recommended for use in local/testing environments.

    mjolnir.ignoreTimeouts=false
    

Configuring Bulkheads

See also Bulkheads.

  • Bulkhead Maximum - The number of Commands that can execute in the Bulkhead concurrently before subsequent Command attempts are rejected.

    Per-bulkhead configuration. bulkhead-key is the argument passed to the Command constructor.

    mjolnir.bulkhead.<bulkhead-key>.maxConcurrent=10
    

    System-wide default. Used if a per-bulkhead maxConcurrent isn't configured.

    mjolnir.bulkhead.default.maxConcurrent=10
    

Configuring Circuit Breakers

See also Circuit Breakers.

  • Global Enable/Disable - Circuit Breakers can be globally disabled.

    mjolnir.useCircuitBreakers=true
    
  • Counting Window - A Breakers monitors error counts within a short, non-rolling window of time, resetting counts when the window ends.

    Per-breaker configuration. breaker-key is the argument passed to the Command constructor.

    mjolnir.metrics.<breaker-key>.windowMillis=30000
    

    System-wide default. Used if a per-breaker windowMillis isn't configured.

    mjolnir.metrics.default.windowMillis=30000
    
  • Minimum Operations - a Breaker won't trip until it sees at least this many operations come through in the configured windowMillis.

    Per-breaker configuration. breaker-key is the argument passed to the Command constructor.

    mjolnir.breaker.<breaker-key>.minimumOperations=10
    

    System-wide default. Used if a per-breaker minimumOperations isn't configured.

    mjolnir.breaker.default.minimumOperations=10
    
  • Threshold Percentage - If the error rate within the window meets or exceeds this percentage, the Breaker will trip.

    Per-breaker configuration. breaker-key is the argument passed to the Command constructor.

    mjolnir.breaker.<breaker-key>.thresholdPercentage=50
    

    System-wide default. Used if a per-breaker thresholdPercentage isn't configured.

    mjolnir.breaker.default.thresholdPercentage=50
    
  • Tripped Duration - When the Breaker trips, it will wait this long before attempting a test operation to see if it should close and fix itself.

    Per-breaker configuration. breaker-key is the argument passed to the Command constructor.

    mjolnir.breaker.<breaker-key>.trippedDurationMillis=10000
    

    System-wide default. Used if a per-breaker trippedDurationMillis isn't configured.

    mjolnir.breaker.default.trippedDurationMillis=10000
    
  • Force Tripped/Fixed - Forces a Breaker tripped (open) or fixed (closed), regardless of its current error count. If both are true, the Breaker will be tripped.

    Per-breaker configurations. breaker-key is the argument passed to the Command constructor.

    mjolnir.breaker.<breaker-key>.forceTripped=false
    mjolnir.breaker.<breaker-key>.forceFixed=false
    

    System-wide default. Used if a per-breaker forceTripped/forceFixed isn't configured.

    mjolnir.breaker.default.forceTripped=false
    mjolnir.breaker.default.forceFixed=false
    

Other Configuration

  • Global Killswitch - Mjolnir can be turned off entirely if needed (though it's certainly not recommended). If isEnabled is set to false, Mjolnir will still do some initial work (like ensuring a single invoke per Command), but will then just execute the Command (calling Execute() or ExecuteAsync()) instead of passing it through Bulkheads and Circuit Breakers. No timeouts will be applied; a CancellationToken.None will be passed to any method that supports cancellation.

    mjolnir.isEnabled=true
    
  • Gauge Metric Intervals - If using an IMetricEvents implementation, these are the intervals that gauges are fired for their respective components.

    mjolnir.bulkheadConfigGaugeIntervalMillis=60000
    mjolnir.breakerConfigGaugeIntervalMillis=60000