Gremlin lets you run multiple Chaos Engineering experiments in a single workflow called a Scenario. Normally these experiments run sequentially, but Gremlin also lets you run experiments in parallel. In this tutorial, we'll show you how to create a Scenario that runs two different experiments simultaneously. We'll show you how to create your own custom Scenario, how to set up branching, and what to consider when creating branched Scenarios.
This tutorial will show you how to:
Before starting this tutorial, you’ll need the following:
In this step, you’ll create a new Scenario by cloning an existing Recommended Scenario. A Recommended Scenario is a pre-built Scenario created by the Gremlin team to test for common use cases like scalability, redundancy, and recoverability. You can run a Recommended Scenario as-is, but in this case, we'll use one as a springboard.
In this step, we'll edit our new Scenario by adding a branch and another experiment. A branch is a series of nodes that runs sequentially. They can run simultaneously alongside other branches and can even contain nested branches.
Give your new Scenario a new name, such as Scalability: CPU and Memory. This helps differentiate it from the default version. We also recommend changing the description to include the memory test.
Scroll down to the Scenario creation pane. You'll see a section for adding Health Checks, followed by a section for adding nodes. Each node represents an action that takes place during the Scenario. The layout should match this screenshot:
At the very bottom of the node list, click Add, then select Concurrent Node. This moves each of the existing nodes under a branch named "Branch 1." Beneath that is a second branch named "Branch 2." Any steps we add to branch 2 will run simultaneous to the steps in branch 1.
Now that we have our new branch, let's add a memory experiment.
Under "Branch 2", click Add Node, then New Test.
In the Edit Test pane:
Double-check your Scenario flow to make sure you now have a 5-minute memory experiment under branch 2. You should now have 7 total nodes.
Click Save Scenario to save your new Scenario.
Now, we get to run our Scenario. After you saved your Scenario, you'll see a button labeled Run Scenario. Click on it, then click Run Scenario again to confirm.
While the Scenario is starting, this would be a great time to pull up any metrics you have for the target system. Metrics will tell you how your system is responding to the test, and whether something unexpected happens, such as a system failure. If you don't have a monitoring or observability solution set up, even something like Windows Task Manager or htop will work. Gremlin also automatically graphs CPU usage during the experiment.
You'll know both experiments are running simultaneously by the animated icon next to their names:
While the Scenario is running, see how your system behaves. Does it run sluggishly? Are any applications or processes slowed down or terminated? Does the system start moving memory to swap space, and if so, how does that impact responsiveness?
If something unexpected or undesirable happens (like the system crashing), remember you can stop the Scenario by clicking the big red Halt Scenario or Halt All Tests buttons in the top-right corner of the web app.
Congratulations, you've successfully created a Scenario that runs two experiments side-by-side! Here are some additional steps you can take to get the most out of your Scenarios:
Branches add a near-infinite number of possible Scenario configurations limited only by your creativity and use cases. If you need more inspiration, remember that we have over 30 additional pre-made Recommended Scenarios that you can use as a template. We also recommend thinking of any recent incidents or outages you or your team have experienced, and building a Scenario that replicates it.
Gremlin empowers you to proactively root out failure before it causes downtime. See how you can harness chaos to build resilient systems by requesting a demo of Gremlin.
Get started