I created a resiliency tool that helps applications tolerate random instance failures within Azure.
An Azure Website has limited tools for testing resiliency, so I created a tool to allow any website to be taken offline with the click of a button. Simply put, this is my attempt at creating the SimianArmy for Azure.
Delayware is a middleware that introduces a random delay into any request or take down a server for a limited time. It listens for a X-POISON header in an request. This header will contain a JWT encoded message to either delay or take down a service.
public static class WebApiConfig {
public static void Register(HttpConfiguration config) {
string secret = "SHHH_SECRET";
config.MessageHandlers.Add(new PoisonHandler(new DefaultPoisonStrategy(secret)));
}
}
Create JWT @ https://jwt.io/
Example to delay the request into service randomly from 500ms to 1000 ms
{
"from" : 500,
"to" : 1000,
"action" : "single",
"type" : "delay"
}
Example to delay any requests into service randomly from 500ms to 1000 ms for the next 30 secs
{
"from" : 500,
"to" : 1000,
"duration": 30,
"action" : "timed",
"type" : "delay"
}
Example to return 500 status code in the request
{
"code" : 500,
"action" : "single",
"type" : "status"
}
Example to return 500 for any requests into service randomly for the next 30 secs
{
"code" : 500,
"duration": 30,
"action" : "timed",
"type" : "status"
}
Encoded JWT with secret SHHH_SECRET eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJmcm9tIjo1MDAsInRvIjoxMDAwLCJhY3Rpb24iOiJzaW5nbGUiLCJ0eXBlIjoiZGVsYXkifQ.qklMQ8H7kJhFfNxpAGTACoBs_7XdMytgg5DPYNpXEPE
curl --header "X-POISON: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJmcm9tIjo1MDAsInRvIjoxMDAwLCJhY3Rpb24iOiJzaW5nbGUiLCJ0eXBlIjoiZGVsYXkifQ.qklMQ8H7kJhFfNxpAGTACoBs_7XdMytgg5DPYNpXEPE" www.myservice.com