Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > macOS > How to limit webserver upload speed?

How to limit webserver upload speed?
Thread Tools
DaveNinja
Forum Regular
Join Date: Jan 2001
Location: Sacramento, CA, USA USA USA
Status: Offline
Reply With Quote
Feb 3, 2003, 01:22 PM
 
I run my website off my G3 B&W with DSL. If someone is downloading one of my mp3s (legal) my internet connection slows to a crawl. is there a way to limit or throttle the upload speed?

-dave

daveninja.com
daveninja.com
     
mrwalker
Dedicated MacNNer
Join Date: May 2002
Location: UK
Status: Offline
Reply With Quote
Feb 3, 2003, 02:25 PM
 
Can be done!

I spent some time sorting this very problem this weekend. I am using the stock build of apache with all sorts of other bits in it.

Assuming you're on OS 10.2.3 with Apache 1.3.27, what you need is build yourself a copy of mod_bandwidth. This is freely available from here: http://www.cohprog.com/v3/bandwidth/intro-en.html

For some reason, the build didn't work for me as per the instructions on the author's website. With a little pushing & pulling, the following worked for me - in all cases don't in clude the quotes:

1. Download the file mod_bandwidth.c to your desktop

2. Open a terminal type 'cd Desktop'

3. Type 'su' & give it your password when asked

4. Type this, with no line breaks, replacing 'mrwalker' with your username:
'gcc -DDARWIN -DUSE_HSREGEX -DUSE_EXPAT -I../lib/expat-lite -g -Os -pipe -DHARD_SERVER_LIMIT=2048 -DEAPI -DSHARED_MODULE -I/usr/include/httpd -c /Users/mrwalker/Desktop/mod_bandwidth.c'

5. Type this:
'cc -bundle -undefined suppress -flat_namespace -Wl,-bind_at_load -o /usr/libexec/httpd/mod_bandwidth.so mod_bandwidth.o'

6. You should now have a file /usr/libexec/httpd/mod_bandwidth.so. Confirm by typing 'cd /usr/libexec/httpd', then 'ls -l'. Make it world executable: 'chmod +x mod_bandwidth.so'

7. Add the following lines to /etc/httpd/httpd.conf by typing 'pico /etc/httpd/httpd.conf'

Below all the other LoadModule lines, add:
'LoadModule bandwidth_module /usr/libexec/httpd/mod_bandwidth.so'

Below all the other AddModule lines, type
'AddModule mod_bandwidth.c'

8. In the global configuration (or virtual host container if you're using them) add the lines

BandWidthModule On
BandWidth all 1024

This will limit the total number of connections to 1024 bytes per second. Change the 1024 as appropriate.

See http://www.cohprog.com/v3/bandwidth/doc-en.html for more config options. I advise adding something like 'LargeFileLimit 8196 0', which will ignore the limit for files below 8k.

9. Type Ctrl-o to save the file & Ctrl-x to exit the pico editor.

10. Add the required temp directories:
mkdir /tmp/apachebw
mkdir /tmp/apachebw/link
mkdir /tmp/apachebw/master
chmod -R 777 /tmp/apachebw

11. Restart apache: 'apachectl restart'

If I typed everything right & you followed me, we're done!

-mrwalker
( Last edited by mrwalker; Feb 3, 2003 at 02:44 PM. )
     
DaveNinja  (op)
Forum Regular
Join Date: Jan 2001
Location: Sacramento, CA, USA USA USA
Status: Offline
Reply With Quote
Feb 3, 2003, 05:09 PM
 
Thanks!

I'll try it when i get home this evening. looks good though (especially the largefile limit, since i only wanted to throttle the mp3s)

-dave ninja
daveninja.com
     
Scotttheking
Moderator Emeritus
Join Date: Dec 2000
Location: College Park, MD
Status: Offline
Reply With Quote
Feb 3, 2003, 07:16 PM
 
Also do an online search for "ADSL-Bandwith-Management"
My website
Help me pay for college. Click for more info.
     
   
Thread Tools
 
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Top
Privacy Policy
All times are GMT -4. The time now is 04:37 PM.
All contents of these forums © 1995-2017 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.8 © 2000-2017, Jelsoft Enterprises Ltd.,