I setup an Apache2 server with the mod_cband to limit download speed at 512kb/s, and I was wondering what happens if I reach the limit.

For example, if my server connection is 100Mb/s, I would theorically be able to serve 195 users. What happen if I have 200 simultaneous users ? Does the last 5 will have an error, or just the download speed that will be lower ?

Thanks for your help !

  • It depends on your config actually; as always. Inlcuding that in your question would help. – HBruijn Oct 17 '14 at 14:17

It's not explicit in the documentation, but from the source it appears that when the limits imposed by mod_cband are exceeded the default behaviour is to generate an HTTP error code/message: Error 503 Service Unavailable which is the HTTP standard error response for temporary problems such as maintenance or when the server is overloaded. If you have a custom ErrorDocument configured in Apache for 503 errors, that will of course be used as well.

Alternatively the module itself allows you to customise the error code with the CBandDefaultExceededCode directive e.g. the non-RFC error 509 bandwidth exceeded comes to mind. In addition you can redirect the visitor to a CBandDefaultExceededURL (typically on a different VirtualHost from the one having mod_cband limits imposed).

If you use mod_cband only to throttle individual users (individual ip-addresses actually, so bad luck for multiple visitors behind a proxy), but not to impose any other limits (such as the number of concurrent connections or total bandwidth) that is exactly what happens, they get assigned an upper limit and each visitor can't consume more than 512 kbit/s of bandwidth. There is no guarantee though for your visitors that they get any level of minimum download speed...
Since your uplink is 100 Mbit/s so if you would get 1000 concurrent downloads, each of those would get a more-or-less fair share of that available bandwidth, that is roughly 100 kbit/s each.

It's the same on my commute back home, my car can achieve 200 km/h, the speedlimit is set at 100 km/h but during rush hour I can manage maybe 50 km/h or less.

  • That's what I was expecting : Since I only limit the download speed , the more user there is, the less bandwidth it will be. Thanks for the precision. – Cyril N. Oct 17 '14 at 14:57

Your Answer

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

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