Toxiproxy: Difference between revisions
From wikinotes
(→Usage) |
|||
Line 53: | Line 53: | ||
you can inspect the 'toxics' (degradations) registered with the cli | you can inspect the 'toxics' (degradations) registered with the cli | ||
<source lang="bash"> | <source lang="bash"> | ||
toxiproxy-cli -inspect | toxiproxy-cli list # list toxics | ||
toxiproxy-cli inspect ${toxic_name} # detailed info about toxic | |||
toxiproxy-cli toxic remove -n ${toxic_name} # delete a toxic | |||
</source> | </source> | ||
</blockquote><!-- Usage --> | </blockquote><!-- Usage --> |
Revision as of 21:59, 28 August 2023
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-serverThen, 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 } ] ')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 #