1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Multiple MySQL databases to avoid too many connections?

Discussion in 'PHP' started by tarponkeith, Dec 5, 2007.

  1. #1
    I've got a site I'm working on right now, and I want to make sure there will be no database errors when the site gets a ton of traffic... I've got two sets of data that would normally just go in two different tables...

    Would it be better to put them in separate databases, instead of just separate tables, to lighten the load when the site gets pounded with traffic?

    Thanks
     
    tarponkeith, Dec 5, 2007 IP
  2. Gawk

    Gawk Peon

    Messages:
    427
    Likes Received:
    36
    Best Answers:
    0
    Trophy Points:
    0
    #2
    How big are your two datasets going to be?
     
    Gawk, Dec 6, 2007 IP
    tarponkeith likes this.
  3. amnezia

    amnezia Peon

    Messages:
    990
    Likes Received:
    31
    Best Answers:
    0
    Trophy Points:
    0
    #3
    won't make any difference putting them in another database. The two databases would still be run via the same MYSQL server so performance limit is still the same. If you're really expecting a ton of traffic then you should look at a mysql cluster.
     
    amnezia, Dec 6, 2007 IP
    tarponkeith likes this.
  4. tonybogs

    tonybogs Peon

    Messages:
    462
    Likes Received:
    13
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Ah this is the fun stuff :)

    Unless you are expecting a mountain of traffic, and i mean millions and millions, of page views a day you wont need 2 databases for production. Keep your database for all writes and use caching to lighten the load for reads

    Read up on memcached : www.danga.com/memcached/

    You can pull data from your database, and then store it in memory so next time you need it you dont have to hit the database again.

    The other option is to use MySQL replication and spread your reads over 2 servers.

    Hope this helps
     
    tonybogs, Dec 6, 2007 IP
    tarponkeith likes this.
  5. tarponkeith

    tarponkeith Well-Known Member

    Messages:
    4,758
    Likes Received:
    279
    Best Answers:
    0
    Trophy Points:
    180
    #5
    Awesome guys, rep added, thanks for the help...

    I'm going to look into "memcache"... I'm not worried about the site getting too much consistent traffic, but more worried about "traffic spikes"... Thanks again...
     
    tarponkeith, Dec 7, 2007 IP
    guerilla likes this.