Spring Boot
Chaos Monkey for Spring Boot
Chaos Monkey for Spring Boot is an open-source tool written in Java that is installed as either an internal or external dependency at startup. Spring Boot for Chaos Monkey can perform three types of Assaults: Latency, Exception, and KillApplication. Assaults are triggered based on Watcher components that monitor @Controller, @RestController, @Service, @Repository, and @Component Spring Boot annotations.
A Watcher can only be triggered by public method calls, which can then execute a configured Assault. A Latency Assault adds random latency to the request, an Exception Assault randomly throws a Runtime Exception, and a KillApplication Assault kills the Spring Boot application.
A few minimal Assault and Watcher settings can be configured via chaos.monkey properties, as listed below.
Most are self-explanatory, but the Assault severity level property (chaos.monkey.assaults.level) actually determines two things: The number of requests between Assaults, and also how many Assaults will occur at that time. Thus, a default level of 5 means that 5 Assaults will occur on every fifth request.
Configuration properties can be changed at runtime via the HTTP endpoints. For example, sending JSON configuration data to the /chaosmonkey/assaults endpoint can be used to modify future Assault configurations.
Check out the reference guide for more information on getting Chaos Monkey for Spring Boot up and running.
Injecting Failure in Spring Boot Applications with Gremlin
Gremlin makes it easy to execute thoughtful Chaos Experiments within your standalone Spring-based applications, including those built with Spring Boot. Rather than inject itself directly into your application's Java code Gremlin performs attacks against the instances powering your application. Gremlin gives you the power to see how the system responds to overloaded CPU and memory and terminated instances.
Running your first Chaos Experiment with Gremlin is as simple as signing up for a Gremlin account, installing the Gremlin agent on the targeted instances, and then launching attacks via either the web UI or API.
Chaos Engineering with Fabric8 and Spring Boot
The Fabric8 development platform has first-class support for building Spring Boot applications and comes with a built-in Chaos Monkey app. The Fabric8 Chaos Monkey is capable of deleting pods within Kubernetes/OpenShift applications.
To get started in the Fabric8 console navigate to Apps, click Run..., select the Chaos Monkey app, and run it. Once the Chaos Monkey app is running within your Fabric8 Sprint Boot deployment you can configure Chaos Monkey using a few options.
- Chaos Monkey Excludes: A comma-separated regex pattern list indicating which pods are not eligible for deletion.
- Chaos Monkey Includes: A comma-separated regex pattern list indicating which pods are eligible for deletion.
- Chaos Monkey Frequency Seconds: The delay between each pod deletion.
You can also optionally run the ChatOps app and set the Chaos Monkey Room configuration option to indicate which chat room Chaos Monkey should communicate with. The Chaos Monkey app will then post notifications of its actions in chat.