Mittens is a tool that can be used to warm up an http application over REST or gRPC.
Mittens can run as a standalone command-line tool, as a linked Docker container, or even as a sidecar in Kubernetes.
Its main features are summarised below:
- Sends requests continuously for X seconds
- Supports REST and gRPC
- Supports HTTP and gRPC headers
- Supports concurrent requests
- Provides files or/and endpoints that can be used as liveness/readiness probes in Kubernetes
The application receives a number of command-line flags. It also supports reading configs from a JSON file. Read the documentation for more context.
Mittens is written in Go and the simplest way to run it is as a cmd application. It receives a number of command line arguments (see Flags).
The project uses Go Modules. We provide a Makefile which can be used to generate an executable binary and a Dockerfile if you prefer to run using Docker.
To build the binary make sure you've installed Go 1.13.
To build the project run the following:
make build
This will generate a binary executable.
To run the tests:
make unit-tests
To run the integration tests:
make integration-tests
To run the binary:
./mittens -target-readiness-path=/health -target-grpc-port=6565 -timeout-seconds=60 -concurrency=3 -http-requests=get:/hotel/potatoes -grpc-requests=service/method:"{\"foo\":\"bar\",\"bar\":\"foo\"}"
To build a Docker image named mittens
:
make docker
To run the container:
docker run mittens:latest -target-readiness-path=/health -target-grpc-port=6565 -timeout-seconds=60 -concurrency=3 -http-requests=get:/hotel/potatoes -grpc-requests=service/method:"{\"foo\":\"bar\",\"bar\":\"foo\"}"
Note: If you use Docker for Mac you might need to set the target host (target-http-host
, target-grpc-host
) to docker.for.mac.localhost
, or docker.for.mac.host.internal
, or host.docker.internal
(depending on your version of Docker) so that your container can resolve localhost.
Please refer to our CONTRIBUTING file.
- Hotels.com - Used in the production environment as a linked Docker container and as a Kubernetes sidecar to eliminate cold starts.
This project is available under the Apache 2.0 License.
Copyright 2019 Expedia, Inc.