Skip to content

Instantly share code, notes, and snippets.

@aheckmann
Created September 1, 2012 17:09
Show Gist options
  • Save aheckmann/3580594 to your computer and use it in GitHub Desktop.
Save aheckmann/3580594 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