1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Advantages of splitting db and front end on 2 VPSs

Discussion in 'Server Configuration and Hosting' started by ibaker, Nov 29, 2011.

  1. ibaker

    ibaker Well-Known Member

    Can someone tell me the advantages of splitting a site over 2 VPSs...the db on one and the front end on another or does it not really matter?

    I have an added bit of complexity with having a video chat room and instant messenger which requires 2 to 3 gig of ram...should that be on another VPS :(

    Finally, if I am going for a new VPS setup, should I consider Litespeed or nginx on it for 2 XF sites...which one is better for XF (150 concurrent, 400meg db, 6,500 reg'd users, 150k posts in 16k threads - but these will grow)

    Thanks for your advice!
  2. Floris

    Floris Guest

    With those stats your xenforo will run just fine on one VPS.
    You could consider moving the hosting of the IM/Video on the second VPS?

    But, a benefit is, 2 vps is 2 i/o operations resources available to you, and ram, and cpu, etc.

    While traffic hits the web server, and increasing it's load.
    The MySQL db could hit the second vps, as sql server, not being affected much by vps_1's load (issues).
  3. ibaker

    ibaker Well-Known Member

    Thanks Floris
    So having the front end on a vps with say 2gig ram and the db + video on a 2nd vps with say 4gig ram would be the way to go...is this your advice?
  4. Claudio

    Claudio Well-Known Member

    how can somebody manage the database in other server? I mean...in that case you shouldn´t used "localhost" as the path, but how you set the path to phpmyadmin from the other server? with the ip?
  5. Andy.N

    Andy.N Well-Known Member

    Use the internal IP of your DB server. You should not be charged for the traffic between 2 servers, provided they are on the same host.
    We have 2 servers setup like that, one for webserver, another for DB. Both use nginx.
  6. dieketzer

    dieketzer Well-Known Member

    you can manage a db server without having a webserver fullstop. i manage mine with a local client over ssh.
  7. MGSteve

    MGSteve Well-Known Member

    yeah, splitting two will work, we did it on our previous hosts, just becareful with the inter-server speed as sometimes its not great - with a decent host though it should be fine. I had to up ours from 10mb/s to 100mb/s and it took a lot of hassle to do so. Was partly my fault though I didn't spot that their network speed was limited to 10mb/s before I placed the order.

    It comes down to cost though, when I moved servers earlier this year, it was cheaper to get one big server than 2 smaller ones and so far its much quicker on one big box.

    We've got 100K users, 4.5m posts etc...
  8. wrx1

    wrx1 Active Member

    I am on Linode and running 2 512 vps. Same cost as running a 1024, but it is much faster with 2. I am running APC on the web side and memcached on the DB side and with 120ish people (50+ members), web side cpu is usually 4-6 and DB cpu is 2 or less. Like Floris stated, the I/O traffic is what kills you on a active site. Now with 2 servers, your available I/O bandwidth increases, along with ram and cpu. You also get the benefit of easy expansion. If your site starts to grow, you can always add another web server, or get a better spec on the web server and if the DB server is handling the extra traffic, you just leave it alone.

    Feel free to hit up my site (in my sig) and check it out.
  9. Floris

    Floris Guest

    You can set a database up to accept a remote incoming per IP, this should be the internal IP.
    Some good vps setups understand this is desirable and allow internal traffic between servers.

    Another great means for SQL load spread is to have 2 vps where 1 is the apache web server with master sql for read/write, and a read only slave database on the other one. Have a dedicated IP on both, and webserver on the second one as well. You can set 2 IN A records for the domain so it splits traffic based on the IP it gets.

    But that's only handy for bigger sites with 1500+ online users and thousands of posts per hour.

    Up to 500 online users a vps that's setup smartly will do just fine, assuming it's a good vps host. Especially if you split web on one, sql on the other.
  10. infis

    infis Well-Known Member

    Also do not forget to specify in config.php usage persistent connection for access to a database on other server - before a database server name it is necessary to specify a flag p, for example:
    $config['db']['host'] = 'p:localhost';
  11. RobParker

    RobParker Well-Known Member

    I didn't realise this and we've now moved to a mini-cluster. Is the above still necessary?
  12. infis

    infis Well-Known Member

    For a small-time access to the database server to use the flag "p" is not necessary.
  13. RobParker

    RobParker Well-Known Member

    Putting p: in front of my db server name and it just caused it to fail to connect to the database.
  14. infis

    infis Well-Known Member

    This work only on PHP 5.3 and above.
  15. RobParker

    RobParker Well-Known Member

    Ah ok, thanks.

Share This Page