-1

I'm trying to use mod_ratelimit, but it's exhibiting some odd behaviour.

Initially, my configuration was:

<Virtualhost>
...
<Directory /var/www/public>
    Order               Allow,Deny
    Allow from All

    Options       FollowSymLinks
    AllowOverride All

    SetOutputFilter RATE_LIMIT
    SetEnv rate-limit 250
</Directory>
...
</Virtualhost>

I've also tried:

<Virtualhost>
    ...
    SetOutputFilter RATE_LIMIT
    SetEnv rate-limit 250
    ...
</Virtualhost>

and

<Virtualhost>
<Location>
    ...
    SetOutputFilter RATE_LIMIT
    SetEnv rate-limit 250
    ...
</Location>
</Virtualhost>

I was expecting the 8 MB file I was downloading to take about 30 seconds. It was done in an instant.

I've tried several values for rate-limit and used wget to time them:

rate-limit | download speed
-----------+---------------
       250 | 440 MB/s
       100 | 440 MB/s
        50 | 440 MB/s
        30 |  20 kB/s
        25 |  20 kB/s
        10 |   6 kB/s
         1 | 500  B/s

This is apache 2.4 running on Ubuntu 14.04

0

1 Answer 1

1

This may be a silly question, however, I ask because it has been missed before: Is the module enabled?

You can see this in /etc/apache2/mods-enabled/. By default, this module is not enabled.

From: https://www.server-world.info/en/note?os=Ubuntu_14.04&p=httpd2&f=7

root@www:~# a2enmod ratelimit 
root@www:~# vi /etc/apache2/conf-available/ratelimit.conf
# create new
# for example, limit bandwidth as 500 KB/sec under the /download location
<IfModule mod_ratelimit.c>
    <Location /download>
        SetOutputFilter RATE_LIMIT
        SetEnv rate-limit 500
    </Location>
</IfModule>
root@www:~# a2enconf ratelimit 
root@www:~# /etc/init.d/apache2 restart

Another popular option is mod_dialup found at: http://httpd.apache.org/docs/2.4/mod/mod_dialup.html

9
  • Yes it's enabled
    – HorusKol
    Commented Dec 13, 2016 at 5:22
  • Hmm, I really don't want to cut all the way back to dial-up speeds... Just 1 MB/s, maybe, for testing
    – HorusKol
    Commented Dec 13, 2016 at 5:24
  • @HorusKol I have no experience with this module, however, you will see the example code is a bit different than what you have done. Even the 2.4 documentation you linked to in your question uses the Location directive. You will want to at least try using a Location directive or matching the example code above. Cheers!!
    – closetnoc
    Commented Dec 13, 2016 at 5:25
  • I've also tried that - it is the same result - and it should not matter if it's in a location or a directory. If you don't have experience, why are you answering?
    – HorusKol
    Commented Dec 13, 2016 at 9:43
  • @HorusKol You will notice that the code is set in the ratelimit.conf. I am not sure that is mandatory or even if ratelimit.conf is mandatory, but still worth a try. Why am I answering? Because all modules are basically the same and Apache is simple. I ask you, has anyone else answered? I do this to help people. I have been at it for 30 years and I am a retired systems internals engineer. I have been through the Apache code up until a few year ago and managed global Internet services on the scale of Google and Microsoft. The module works according to some. It is just a matter of time to solve.
    – closetnoc
    Commented Dec 13, 2016 at 19:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.