-
Notifications
You must be signed in to change notification settings - Fork 10
Installing and Configuring
Installation is fairly minimal - just grab Hudl.Mjolnir from nuget.org using your Package Manager GUI or Console.
Mjolnir needs you to specify a configuration provider. The ConfigurableValue
s within the app all have sensible defaults, but you'll want to adjust them after observing how your application behaves.
Mjolnir ships with a configuration provider implementation that can read configuration values from a file; set the provider on application startup (before you use any Commands):
using Hudl.Config;
//...
ConfigProvider.UseProvider(new FileConfigurationProvider(@"c:\path\to", "config-file.txt"));
Configuration file contents are just Key=Value
pairs, e.g.:
mjolnir.command.core-client.GetUser.Timeout=5000
mjolnir.pools.core-user.threadCount=20
If a specific configuration value (e.g. for a breaker or command) isn't defined, you can also define fallback defaults via config, e.g.:
mjolnir.breaker.default.windowMillis=10000
mjolnir.pools.default.threadCount=10
See Configuration Keys for available timeout, bulkhead, breaker, and other keys.
If you don't set a configuration provider, default values (defined in the code) will be used for everything in Mjolnir (which isn't ideal, because you'll want to tune components and commands for your application).
You can also inject your own metrics handler. We typically use Riemann, but other services like statsd should work well, also.
You'll need to implement Hudl.Mjolnir.External.IStats
and set it on CommandContext
.
TODO metrics vs. stats. consider nuking stats here and just doing metrics.
using Hudl.Mjolnir;
using Hudl.Mjolnir.External;
//...
CommandContext.Stats = new MyStats();
You'll want to set CommandContext.Stats
early on application startup; breakers and pools will cache their stats implementations, and won't pick up a new one if you set it after they've been created.
See the list of available metrics.
Mjolnir uses SmartThreadPool, but has to package and reference it directly. See Issue #16.
===== « When to Use • Commands »