Controlling your visitors/users bandwidth usage and speed using mod_cband

Again, I’m using my beloved Debian 6 squeeze distribution to test this tutorial.
What is mod_cband? Directly taken from the one that maintain this piece of work:

mod_cband is an Apache 2 module provided to solve the problem of limiting users’ and virtualhosts’ bandwidth usage. The current versions can set virtualhosts’ and users’ bandwidth quotas, maximal download speed (like in mod_bandwidth), requests-per-second speed and the maximal number of simultanous IP connections (like in mod_limitipconn)

I recommend you to install this module into your server if your site providing download or stream service. Benefit after installing this module is: justice for all. For you as server owner: you can control the bandwidth usage and limiting your user’s download/stream speed, keep your server’s memory usage in control. For users: high availability server, no users dominate the bandwidth alone.

OK, let’s start:
install needed package (you need to compile mod_cband by yourself)

download and extract mod_cband

EDIT: it seems that site is not hosting mod-cband anymore, you can download mod-cband form my site instead:

go inside mod-cband directory and do ./configure

fixing Makefile; without doing this trick, you will get error message when trying to restart Apache2 afterwards. This is the error messages:

apache2: Syntax error on line 203 of /etc/apache2/apache2.conf: Syntax error on line 1 of /etc/apache2/mods-enabled/cband.load: Cannot load /usr/lib/apache2/modules/ into server: /usr/lib/apache2/modules/ undefined symbol: truncf
Action ‘configtest’ failed.
The Apache error log may have more information.

edit Makefile produced by ./configure before. add “-lm ” after “APXS_OPTS=” and before “-Wc” on line 12. See screenshot:

cband Makefile

Watch for line #12

save it and then do “make&&make install

restart apache2

This isn’t enough. Now, configure your virtual host to use mod_cband. This just example virtual host configuration that I use:

For more extensive and descriptive options, head to mod_cband documentation page

Example result:

Leave a Reply

Trackbacks and Pingbacks:

%d bloggers like this: