Throttle uses pfctl on Mac and tc on Linux to simulate different network speeds.
You can set the download/upload speed and RTT. Upload/download is in kbit/s and RTT in ms.
This is an early release, so please help us find potential bugs.
npm install @sitespeed.io/throttle -g
Here is an example for running with 3G connectivity. Remember: Throttle will use sudo so your user will need sudo rights.
throttle --up 330 --down 780 --rtt 200
To make it easier we have pre made profiles, check them out by throttle --help:
--profile Premade profiles, set to one of the following 3g: up:768 down:1600 rtt:150 3gfast: up:768 down:1600 rtt:75 3gslow: up:400 down:400 rtt:200 2g: up:32 down:35 rtt:650 cable: up:1000 down:5000 rtt:14
You can start throttle with one of the premade profiles:
throttle --profile 3gslow
Stopping is as easy as giving the parameter stop to throttle.
This is useful if you run WebPageReplay and want to add som latency to your tests.
throttle --rtt 200 --localhost
throttle --stop --localhost
const throttle = ;// Returns a promisethrottlestartup: 360 down: 780 rtt: 200
Make sure to run
sudo modprobe ifb numifbs=1 before you start the container.
And then when you actually start your Docker container, give it the right privileges with