Skip to content

Instantly share code, notes, and snippets.

@vindir
Forked from aheckmann/simulateSlowMongod.sh
Created June 20, 2017 13:57
Show Gist options
  • Save vindir/2d64f65c1bd6cfc3cabbd8b74d4a4429 to your computer and use it in GitHub Desktop.
Save vindir/2d64f65c1bd6cfc3cabbd8b74d4a4429 to your computer and use it in GitHub Desktop.
simulate high latency replica sets (mac)
# first set up a pipe named "2" with bandwidth
# limited to 16kbit/s and latency of 100ms
sudo ipfw pipe 2 config bw 16Kbit/s delay 100ms
# next add rule #1 using the pipe we set up, configured to
# act only on local tcp traffic going to port 27019
sudo ipfw add 1 pipe 2 tcp from me to me 27019 out
# now you should be observing slow ping times for
# mongod on 27019
# let's disable rule #1
sudo ipfw delete 1
# back to normal!
# our pipe still exists so if we want to enable it again
sudo ipfw add 1 pipe 2 tcp from me to me 27019 out
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment