Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a video website running on a VPS under Apache2 that will soon start doing pay per view. Until it starts generating decent revenue, I don't want to invest in more servers, so to start with I need to provide a good enough service to the customers I get.

I also host a couple of other websites, but these aren't expected to use a lot of bandwidth.

I know that my major bottleneck is bandwidth - so I think the best thing to do is to prevent access to the video site to new connections once my bandwidth limit gets near. Anyone who is already viewing a movie should not be affected.

Any ideas on the best way to achieve this?

Update: The bandwidth limitation isn't my allocated bandwidth from the provider but rather the available bandwidth for my VPS through the network card. I found that once I hit about 250 simultaneous downloads things start to deteriorate. Assuming each download is at 1mbps I want to start throttling things once I hit 250mbps - in theory I can get 1000mbps, but it doesn't look like that really works.

share|improve this question

You may also try looking at mod_bandwidth which is able to define Bandwidth Limits on server-wide or per connection bandwidth limits. It does not prevent further connections from happening, since this can be achieved using the MaxClients directive.

Since I assume you are using mpm_worker it would be interesting what your settings for ThreadsPerChild are.

mod_bandwidth limits may either be based on the

  • location of the file
  • size of files
  • and remote IP/domain.

My approach would be to Limit simultaneous connections via the MaxClients directive to 250. Than using mod_bandwidth I'd make sure that every clients get's a "fair share" of the bandwidth and not bandwidth monopolism.

share|improve this answer
Do you happen to know whether mod_bandwidth reduces the bandwidth for each connection, allowing further connections, or if it prevents further connections once the bandwidth limit is reached. The docs/FAQ don't make this clear. I'm after the latter. – dunxd Nov 10 '10 at 11:58
See my updated post for more information. – pacey Nov 10 '10 at 12:34

Can you provide us with more info, for example.

Server OS, your allocated bandwidth, your programming levels etc.

Have you considered a CDN?

share|improve this answer
CDN is an expense I don't want to incurr at this stage. If things get exciting then I'll consider it, but right now I am looking to avoid any such investment till it looks like I really need it. – dunxd Nov 9 '10 at 15:56
have you considered a caching service? Such as Coral CDN ( – Kyle Hudson Nov 9 '10 at 20:59

Have you considered hosting your "website" on a standard hosting package, and then using the VPS for serving the files? That way your website will always be available.

Most VPS and cloud providers provide fully fledged API's where you can see how much BW is been used etc. Also how are you serving your files? Is it via server side code?

Failing that without more info all I can suggest is either this answer or a CDN.

share|improve this answer
Hosting the files separately is a good option - although a standard hosting package may use a server less capable/more congested than my VPS. Unfortunately (actually fortunately) my service provider has not yet implemented bandwidth monitoring/reporting for their VPS system. – dunxd Nov 9 '10 at 15:58

Your Answer


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.