/
HowTo: Change Bandwidth and Latency on MacOS

HowTo: Change Bandwidth and Latency on MacOS

The purpose of changing bandwidth and latency on MacOS or Linux machine is to simulate running Mattermost applications on low bandwidth and/or high latency connectivity. This can be done locally, or (hopefully) on Github Runner

Applications like Charles Proxy or Network Link Conditioner (MacOS system preference) can be downloaded and have the ability to throttle bandwidth & latency using GUI. However, it is not easily installable in CICD runners like Github.

 

# must be done as a sudoer sudo su dnctl -q flush dnctl -q pipe flush pfctl -f /etc/pf.conf pfctl -E # disabling, flushing and resetting pfctl -d dnctl -q flush dnctl -q pipe flush dnctl pipe 1 config delay 0ms noerror dnctl pipe 2 config delay 0ms noerror echo "dummynet in from mobile-e2e-site-1.test.mattermost.cloud to ! 127.0.0.1 pipe 1 dummynet out from ! 127.0.0.1 to mobile-e2e-site-1.test.mattermost.cloud pipe 2" | sudo pfctl -f - # pipe 1 is download, below is 3.3Mb/s with 1000ms latency dnctl pipe 1 config bw 3300Kbit/s delay 1000ms # pipe 2 is upload, below is 3.3Mb/s with 1000ms latency dnctl pipe 2 config bw 3300Kbit/s delay 1000ms # enabling, -E pfctl -E # to stop, -d pfctl -d # to completely reset, do the "disabling, flushing and resetting"

 

references: