Bandwidth Throttling?


#1

I’ve been thinking about how to set up multiple sites on the same plan without having them interfere with each other too badly. It’s great to be able to limit the amount of disk space that any particular user/e-mail user can suck up, but I’m wondering about the same sort of thing for bandwidth.

That is, if I’ve got domain.com and dude.domain.com, but I don’t want dude.domain.com being able to suck up more than a couple of GB of my monthly transfer and costing me a bundle on the chance it suddenly becomes wildly popular, I’d be nice to be able to set some sort of limit that way.

That’s not the way Dreamhost is set up at all, so I doubt I’ll ever see something like that through the web panel, but is there some sort of server-side tool to filter things through that might be able to limit the number of downloads per day, or something like that?

I guess I’m just thinking out loud, but maybe somebody can offer a suggestion.


#2

We don’t currently have any way to do this. Unless one of the sites is really busy, however, it’s unlikely that you’d be going over your bandwidth allocation anyway (especially with the recent increases in bandwidth allocation).


#3

You might be interested in the following article that appeared in Linux Magazine a few issues back where a veteran Perl programmer, Randal Schwarz, discusses how to go about writing your own bandwidth throttling program in Perl, along wtih examples and source code.

http://www.linux-mag.com/2000-10/perl_01.html

Rgds

Wil

Web Developer
http://www.fbagroup.co.uk/


#4

That’s an interesting project, and generally the kind of thing I was thinking of, but of course since it uses mod_perl, it wouldn’t do any good on a shared server.

As for what the point is in the first place, the chances aren’t that high of any site doing sudden, massive bandwidth, but I was thinking of the slashdot effect with large-ish files. A few thousand people downloading a particularly cool 500K Flash animation adds up relatively quickly, and if I (or more importantly another user on my plan) posted a 50+MB video file, it doesn’t take a whole lot for things to get ugly.

Anyway, I wasn’t expecting this to be anything easy, but the info is still interesting.


#5

If you upgraded to a dedicated server, you could also look into Dreamhost installing mod_throttle for you which throttles bandwidth on a per-user/IP basis.

I’m sure there must be a way to do this through .htaccess or equivalent control files.

  • wil

#6

Yep. This happens from time to time, presumedly less and less often though as we increase the bandwidth consumption we include with our hosting plans.

If it’s a big surprise, and someone is concerned about having trouble paying their bill, we’ve been known to find ways to help them out financially. It never hurts to ask.

We are also available to give tips on better resource usage, ie. by using mod_gzip or streamlining graphics or changing the structure of a site. Sometimes people run up high bandwidth bills by simply putting too much on their site’s main pages.

One other thing we’ve been careful about doing is letting people know that they’re likely to go over their bandwidth cap, before they ever do. We have an automated system that ‘predicts’ overage costs due to such usage spikes, and tries to give fair warning via email.

Unfortunately, even that doesn’t work too well if you suffer from the dreaded Slashdot Effect™ and it all spikes up in the span of a single day or two. Luckily, only maybe 5% of our customers ever get close to their bandwidth cap - and those that do are usually pretty savvy about making money from all that traffic, and can pay for it.

  • Jeff @ DreamHost
  • DH Discussion Forum Admin

#7

Amen to all of the above, Jeff. If it were just lots and lots of traffic, the average user should be able to deal one way or another–I, for one, got plenty of practice with that back when the bandwidth limits were a lot lower at DreamHost.

It’s just that nagging fear of saying “hey, this file’d be cool to put up”, then waking up one morning to find a DreamHost “your bandwidth is projected to be 800GB this billing period” message in my inbox.

No amount of preperation or tweaking can perfectly protect from sudden, exponential popularity, which is why it’d be nice to have some way to just say “if this subdomain/file/directory exceeds 5GB in a month, 503 it and let me know.” Maybe someday that feature’ll be announced in the newsletter.

On the other hand, if I had any time/talent I could write a script to spit out file x and keep a count of the number of times that happened, then stop spitting it out when the counter reached some number. Not foolproof, I suppose, but better than nothing.


#8

[quote]Maybe someday that feature’ll be announced in the
newsletter.

[/quote]

We do that from time to time. :>

[quote]On the other hand, if I had any time/talent I could write
a script to spit out file x and keep a count of the number
of times that happened, then stop spitting it out when the
counter reached some number. Not foolproof, I suppose, but
better than nothing.

[/quote]

This sounds like an option. If we get enough requests for this sort of thing, we might be able to write a simple little script for just such a thing.

I wouldn’t be too surprised if there’s a Perl script out there that does it now, actually.

  • Jeff @ DreamHost
  • DH Discussion Forum Admin

#9

we could probably install mod_throttle on a dedicated server plan without too much difficulty.

we could also look into using altq or something similar (on an OpenBSD box), and running connectings to the machine through that.

this would probably involve some setup fees of some sort, and would be a more complex solution.