Apache by default will serve files to the users as fast as the bandwidth or
TCP/IP allow for. In an environment where for example you are hosting files for download and you don't want a single user to hog all your server's bandwidth, you might want to throttle the download speed for your users so that your server is able to serve more users at a time.
You can limit the download speed of your
Apache users by using
mod_ratelimit and specify the desired speed for each
Steps to throttle download speed on Apache:
$ sudo a2enmod ratelimit # Ubuntu and Debian [sudo] password for user: Enabling module ratelimit. To activate the new configuration, you need to run: systemctl restart apache2
Apacheconfiguration file for a specific
VirtualHostconfiguration where you want the bandwidth to be limited.
<VirtualHost *:80> # ..... # .... SetOutputFilter RATE_LIMIT SetEnv rate-limit 512 SetEnv rate-initial-burst 1024 </VirtualHost>
Apacheservice for the changes to take effect.
$ sudo systemctl restart apache2 # Ubuntu and Debian $ sudo systemctl restart httpd # CentOS and Red Hat
$ curl --output image.iso www.simplified.guide/image.iso % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 3 512M 3 19.7M 0 0 538k 0 0:16:13 0:00:37 0:15:36 508k
|Ubuntu 16.04 LTS (Xenial Xerus)|
|Ubuntu 16.10 (Yakkety Yak)|
|Ubuntu 17.04 (Zesty Zapus)|
|Ubuntu 17.10 (Artful Aardvark)|
|Ubuntu 18.04 LTS (Bionic Beaver)|
|Ubuntu 18.10 (Cosmic Cuttlefish)|
|Ubuntu 19.04 (Disco Dingo)|
Comment anonymously. Login not required.