[GRLUG] Hosting ideas

Michael Mol mikemol at gmail.com
Fri Mar 21 23:52:35 EDT 2008


On Fri, Mar 21, 2008 at 11:07 PM, Tim Schmidt <timschmidt at gmail.com> wrote:
>
> On Fri, Mar 21, 2008 at 10:47 PM, Michael Mol <mikemol at gmail.com> wrote:
>  > I run a site called Rosetta Code.  It's a fairly active wiki, with
>  >  around 500 edits per week and around 10,000 page views per week,
>  >  sometimes more.  Currently, the database weighs in at about 130MiB.
>  >
>  >  Combined the database size, my shared hosting account at Bluehost, and
>  >  my desire to do backups, and you get a problem.  See, this evening I
>  >  wrote a script that would run mysqldump on the database and save it to
>  >  my home machine.  Problem is, running mysqldump on that database on
>  >  that server* causes sites to start spitting HTTP 500 errors, and my
>  >  account gets suspended for a minute until the CPU utilization sliding
>  >  window passes.
>  >
>  >  * Bluehost has the MySQL server and Apache server on the same box for
>  >  any given account.
>  >
>  >  So I can't exactly automate it without taking down my site (and
>  >  possibly many others) each time.  I need to find different hosting for
>  >  Rosetta Code.  Preferably something that won't choke when I pull
>  >  100+MB of data out of the database every morning over an SSH
>  >  connection.
>
>  You could pipe the mysqldump output through something to throttle
>  it...  bzip2 comes to mind, but that wouldn't lower your CPU
>  utilization.  Sure seems like something < 5 lines of perl could get
>  done though.

Well, it worked out to 10 lines, but here it is.  I'll give it a try.

#!/usr/bin/perl -w
use strict;
my $rate = 25*1024; # 25KB/s

my $count = 0;
do
{
        my $buf;
        $count = read STDIN, $buf, $rate;
        print $buf;
        sleep 1 if $count == $rate;
} while( $count == $rate );


-- 
:wq


More information about the grlug mailing list