mirror of
https://github.com/empayre/fleet.git
synced 2024-11-06 17:05:18 +00:00
78df7b6f70
* Add guide on how to simulate slow connections to redis and mysql * Add pageOrderInSection
46 lines
1.4 KiB
Markdown
46 lines
1.4 KiB
Markdown
# Simulate slow network
|
|
|
|
The following guide allows the developer/tester to simulate a "slow" connection from Fleet to Redis/MySQL.
|
|
(It could be used in a similar way to simulate a slow Fleet server too.)
|
|
|
|
The guide assumes you'll build and run the Fleet server locally with the `make fleet` and `./build/fleet serve` commands.
|
|
|
|
(Has been tested on macOS only.)
|
|
|
|
## 1. Start services
|
|
|
|
```sh
|
|
docker-compose up
|
|
```
|
|
|
|
## 2. Build Fleet
|
|
|
|
```sh
|
|
make fleet
|
|
```
|
|
|
|
## 3. Create a new proxy
|
|
|
|
The following command will create a "slow" proxy to the MySQL server that listens on 22220.
|
|
|
|
```sh
|
|
curl -s -XPOST -d '{"name" : "mysql", "listen" : "toxiproxy:22220", "upstream" : "mysql:3306"}' http://localhost:8474/proxies
|
|
{"name":"mysql","listen":"172.30.0.9:22220","upstream":"mysql:3306","enabled":true,"toxics":[]}%
|
|
```
|
|
|
|
## 4. Run fleet
|
|
|
|
Run fleet as usual but connect to MySQL via the proxy created in step (3):
|
|
```sh
|
|
./build/fleet serve --dev --dev_license --logging_debug --mysql_address localhost:22220 2>&1 | tee ~/fleet.txt
|
|
```
|
|
|
|
## 5. Configure proxy with latency/jitter
|
|
|
|
Configure 1 second of latency with 500ms of jitter in all DB requests:
|
|
```sh
|
|
curl -s -XPOST -d '{"type" : "latency", "attributes" : {"latency" : 1000, "jitter": 500}}' http://localhost:8474/proxies/mysql/toxics
|
|
{"attributes":{"latency":5000,"jitter":0},"name":"latency_downstream","type":"latency","stream":"downstream","toxicity":1}%
|
|
```
|
|
|
|
<meta name="pageOrderInSection" value="1400"> |