Pumba - Chaos Testing for Docker
Update (27-07-27): Updated post to latest v0.2.0
Pumba version change.
Introduction
The best defense against unexpected failures is to build resilient services. Testing for resiliency enables the teams to learn where their apps fail before the customer does. By intentionally causing failures as part of resiliency testing, you can enforce your policy for building resilient systems. Resilience of the system can be defined as its ability to continue functioning even if some components of the system are failing - ephemerality. Growing popularity of distributed and microservice architecture makes resilience testing critical for applications that now require 24x7x365 operation. Resilience testing is an approach where you intentionally inject different types of failures at the infrastructure level (VM, network, containers, and processes) and let the system try to recover from these unexpected failures that can happen in production. Simulating realistic failures at any time is the best way to enforce highly available and resilient systems.
Testing Strategies for Docker Containers
Congratulations! You know how to build a Docker image and are able to compose multiple containers into a meaningful application. Hopefully, you’ve already created a Continuous Delivery pipeline and know how to push your newly created image into production or testing environment.
Now, the question is - How do we test our Docker containers?
There are multiple testing strategies we can apply. In this post, I’ll highlight them presenting benefits and drawbacks for each.
Docker Pattern: The Build Container
Let’s say that you’re developing a microservice in a compiled language or an interpreted language that requires some additional “build” steps to package and lint your application code. This is a useful docker pattern for the “build” container.
In our project, we’re using Docker as our main deployment package: every microservice is delivered as a Docker image. Each microservice also has it’s own code repository (GitHub), and its own CI build job.
Docker Pattern: Deploy and update dockerized application on cluster
Docker is great technology that simplifies development and deployment of distributed applications.
While Docker serves as a core technology, many issues remain to be solved. We find ourselves struggling with some of these issues. For example:
- How to create an elastic Docker cluster?
- How to deploy and connect multiple containers together?
- How to build CI/CD process?
- How to register and discover system services and more?
For most, there are open source projects, or services available from the community as well as commercially, including from Docker, Inc.