Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I want to limit simultaneous requests & throttle bandwidth per IP/Client on a single apache vhost. In other words, I want to ensure that this site, which hosts large media files, doesn't get hammered by someone trying to download everything all at once (just happened the other night).

I'd like to limit the outgoing transfer speed overall for this site, as well as limit the number of connections a single IP can make to the server to a sane default (i.e. within normal browser limits for multiple requests so page loads aren't effected too much). Bonus points if I can actually scope it to file types (i.e. leave web files alone, but apply these rules to just the media files).

We're running Ubuntu 9.04 on all the servers, and have two apache/php servers being load balanced via Round Robin by a squid proxy server. MySQL is running on its own box as well. We've got plenty of bandwidth to give them, so I don't really want overall caps, but just want to throttle the amount of memory/CPU it takes to serve this site. There are other sites on these servers that we don't want to apply these rules too, just want to keep this one from hogging all the resources.

Let me know if you need more info! Thanks in advance for your suggestions!

share|improve this question
    
Not that it matters all that much to me, but mod_bw that is in the neighborhood that is in the Ubuntu default apt-get repositories. –  xentek Mar 23 '10 at 7:34
add comment

2 Answers

up vote 5 down vote accepted

try to use http://opensource.adnovum.ch/mod_qos/ mod_qos now taking care of anything :)

share|improve this answer
1  
I no longer work on the project the prompted the original question, but this module looks like it would have done the trick. Marking this as the accepted answer but with one caveat: I haven't tried mod_qos in production myself. –  xentek Nov 5 '11 at 18:19
add comment

http://www.cohprog.com/mod_bandwidth.html would take care of about 80% of what you need.

For shaping traffic, you might look at tc from http://lartc.org/

share|improve this answer
    
Are you using mod_bandwidth in production? Last update to that module was 2007(?) which I take to mean that its perfect, or development was abandoned. Checking out tc/lartc.org, which I saw recommended in other serverfault threads... this might be a bit above my head (more of a dev with sysadmin skills then any kind of networking genius). –  xentek Mar 23 '10 at 2:52
1  
I have run it (and the predecessor mod_throttle - which does do 100% of what you need) for years. There really isn't that much to it. mod_throttle was pulled off the web some time ago but, you might be able to find a copy. I don't know if it was ever converted to apache 2.2. tc would allow traffic shaping which isn't really as difficult as you would think. The question would be whether or not you could shape traffic on a subinterface - I've only done it for a physical interface. –  deleted Mar 23 '10 at 8:29
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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