Use this if you want to simulate a delay between 2 services running on your local machine (for example between an application server and a database).
We'll setup a Vagrant virtual machine running haproxy. An artifical delay can then be added using netem
- Unzip this gist in a directory.
- Edit
haproxy.cfg
to setup the port forwarding - Go to that directory and run
vagrant up
- Launch a shell in the vm with
vagrant ssh
- Start haproxy with
/usr/sbin/haproxy -D -f /vagrant/haproxy.cfg
- You can now access the proxy at
192.168.50.4
From the vagrant machine, run sudo bash /vagrant/adjust-delay.sh 150ms
to set the delay to 150ms. To disable it just set it to 0ms.
To check that the delay is working, you can use this command (adjust the port number) from another linux machine sudo traceroute -T -p 1521 192.168.50.4