Skip to content

ExpediaGroup/mittens

Folders and files

NameName
Last commit message
Last commit date

Latest commit

6446db6 · Apr 22, 2024
Mar 9, 2024
Jan 12, 2024
Jan 12, 2024
Jan 2, 2024
Oct 17, 2019
Mar 8, 2024
Feb 3, 2024
Apr 22, 2024
Jan 2, 2024
Sep 30, 2019
Sep 30, 2019
Dec 18, 2023
Oct 1, 2019
Apr 8, 2021
Apr 22, 2024
Apr 22, 2024
Apr 22, 2024
Nov 17, 2019

Repository files navigation

Mittens

Build Status Go Report Card License GitHub site Docker

Mittens

Mittens is a tool that can be used to warm up an http application over REST or gRPC. For a more detailed overview and the background behind this project you can read our blogpost.

Features

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/1.1, HTTP/2 and HTTP/2 Cleartext protocol for REST
  • Supports placeholders for random elements in requests
  • Supports concurrent requests
  • Provides files or/and endpoints that can be used as liveness/readiness probes in Kubernetes
  • Allows readiness to fail if unable to warm up target app

Usage

The application receives a number of command-line flags. Read the documentation for more context.

How to build and run

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.

Binary

To build the binary make sure you've installed Go 1.21.

Build binary executable & run tests

To build the project run the following:

    make test

This will run the unit tests and generate a binary executable.

Run the executable

To run the binary:

    ./mittens -target-readiness-http-path=/health -target-grpc-port=6565 -max-duration-seconds=60 -concurrency=3 -http-requests=get:/hotel/potatoes -grpc-requests=service/method:"{\"foo\":\"bar\",\"bar\":\"foo\"}"

Docker

Build image

To build a Docker image named mittens:

    make docker

Run container

To run the container:

    docker run mittens:latest -target-readiness-http-path=/health -target-grpc-port=6565 -max-duration-seconds=60 -concurrency=3 -http-requests=get:/hotel/potatoes -grpc-requests=service/method:"{\"foo\":\"bar\",\"bar\":\"foo\"}"

Note: If you use Docker for Mac/Windows you might need to set the target host (target-http-host, target-grpc-host) to host.docker.internal so that your container can resolve localhost. If you use an older version of Docker (< 18.03), the value will depend on your Operating System, e.g. docker.for.mac.host.internal or docker.for.win.host.internal. For target-http-host, you need to prefix the host with the scheme, e.g. http://host.docker.internal.

Contributing

Please refer to our CONTRIBUTING file.

Use Cases

References

Legal

This project is available under the Apache 2.0 License.

Copyright 2024 Expedia, Inc.