Toxiproxy: Difference between revisions
From wikinotes
No edit summary |
(→Usage) |
||
(2 intermediate revisions by the same user not shown) | |||
Line 11: | Line 11: | ||
|- | |- | ||
| custom toxics || https://github.com/Shopify/toxiproxy/blob/main/CREATING_TOXICS.md | | custom toxics || https://github.com/Shopify/toxiproxy/blob/main/CREATING_TOXICS.md | ||
|- | |||
| HTTP API || https://github.com/Shopify/toxiproxy#http-api | |||
|- | |- | ||
|} | |} | ||
Line 47: | Line 49: | ||
] | ] | ||
') | ') | ||
toxiproxy -host 127.0.0.1 -port 1234 | |||
</source> | </source> | ||
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 --> |
Latest revision as of 23:29, 31 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 } ] ') toxiproxy -host 127.0.0.1 -port 1234you 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 #