Remix.run Logo
Using Linux tc to limit the outgoing bandwidth of a web server(utcc.utoronto.ca)
6 points by LorenDB 9 hours ago | 1 comments
Bender 6 hours ago | parent [-]

I use something similar and found it to balance traffic among people evenly mostly and that is sch_cake. Turns out it isn't just for home routers and works well on low traffic servers meaning I dont have like 30k+ concurrent active downloads.

    tc qdisc replace dev eth0 root handle 1: cake bandwidth 4200mbit besteffort rtt 80ms nonat triple-isolate split-gso
The server is allowed 6tb/s but I don't want it to use all that. I lower to rtt to somewhere between 60ms and 80ms depending where I create the VM to optimize for the US. Default is 100ms.

The same can be applied to inbound traffic if one so desires, just makes tcpdump messy if I use -i any.

    modprobe ifb numifbs=1 && ip link set dev ifb0 up
    tc filter add dev eth0 parent ffff: protocol ip u32 match u32 0 0 action mirred egress redirect dev ifb0 2>/dev/null
    tc qdisc add dev ifb0 root handle 1: cake bandwidth 200mbit besteffort rtt 80ms nonat triple-isolate split-gso 2>/dev/null