Toxiproxy

From wikinotes

A tool to help test your application for points of failure,
by simulating down/bad-network conditions.

Documentation

github https://github.com/shopify/toxiproxy
available toxics https://github.com/Shopify/toxiproxy#toxics
custom toxics https://github.com/Shopify/toxiproxy/blob/main/CREATING_TOXICS.md
HTTP API https://github.com/Shopify/toxiproxy#http-api

Usage

First, start the server, leave it running in the background

toxiproxy-server

Then, register some network conditions to simulate

# declare on cli
toxiproxy-cli create \
  -l localhost:26379 \ `# proxy`
  -u localhost:6379 \ `# upstream`
  my_redis

# load from json
toxiproxy -config <(echo '
[
  {
    "name": "web_dev_frontend_1",
    "listen": "[::]:18080",
    "upstream": "webapp.domain:8080",
    "enabled": true
  },
  {
    "name": "web_dev_mysql_1",
    "listen": "[::]:13306",
    "upstream": "database.domain:3306",
    "enabled": true
  }
]
')

toxiproxy -host 127.0.0.1 -port 1234

you can inspect the 'toxics' (degradations) registered with the cli

toxiproxy-cli list                           # list toxics
toxiproxy-cli inspect ${toxic_name}          # detailed info about toxic
toxiproxy-cli toxic remove -n ${toxic_name}  # delete a toxic

Toxics

Toxics are the degradations you can configure on your proxy (ex. add latency or timeouts)

# add latency to requests
toxiproxy-cli toxic add -t latency -a latency=1000 shopify_test_redis_master

# service down

# reduced bandwidth

# timeouts

# slow-to-close connections

#