I was wondering if anybody has any solutions for throttling bandwidth on an Xserve (running Apache 2); I'm trying to use mod_bw (http://ivn.cl/category/apache/#bandwidth), but have been running into problems. I can build the right module using apxs, but I run into problems when I try to restart Apache (it says that mod_bw.so is compiled for the wrong architecture).



You can do bandwidth throttling using the dummynet feature of the firewall (instructions at Mac OS X Hints and AFP548, but since these are just tied to TCP port numbers, they can't distinguish between different virtual hosts, client connections, etc.

You're probably better off fixing the architecture mismatch. Run file /usr/libexec/apache2/mod_bw.so to see what architecture(s) the module was built for, and file /usr/sbin/httpd to see what httpd is built for (under 10.6, it should be X86_64, i386, and ppc). To control what architecture(s) the module is built for, I think you can just add -arch flags to be passed to the compiler and linker, e.g.

apxs -Wc,"-arch x86_64" -Wc,"-arch i386" -Wc,"-arch ppc" -Wl,"-arch x86_64" -Wl,"-arch i386" -Wl,"-arch ppc" ...

It's probably best to match the architectures httpd is compiled for, but only really necessary to include whatever mode it's actually running in; to find this out, you can view it in Activity Monitor.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy