Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


Keeping A Massive Site Online Using Nothing But Tiny VPS
New on LowEndTalk? Please Register and read our Community Rules.

All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.

Keeping A Massive Site Online Using Nothing But Tiny VPS

BlueVMBlueVM Member
edited February 2012 in General

Alright I have a friend who owns a massive site... lets call it myawsomesite.com.

Now he currently pays over $300 for a two server setup monthly to keep this massive site online and his server does have a decent amount of load. He's running apache at the moment with a very poorly configured mysql setup. His site does occasionally go down due to the load/server crashes/etc...

Now I'd like to design him the perfect array of VPS for say $50 a month that could handle his site and keep it online no matter what. So what would you do given you had $50 and needed to build this array?

«1

Comments

  • nGinx + PHP FastCGI, configure to use sockets instead of :9000. It would be able to handle a lot of traffic/requests, and keep resource usage minimal.

    If you use Debian Squeeze, I'd suggest using DotDeb repo for the latest MySQL 5.5 server (newest production version). Good luck.

  • @asurahosting:
    is there that much of a difference between :9000 and socket?

  • @djvdorp said: is there that much of a difference between :9000 and socket?

    Yes; There is a notice-able difference in how many requests can be handled, and the speed between the two.

  • prometeusprometeus Member, Host Rep

    Agree with AsuraHosting, I would use one vps for mysql and 1 or more with nginx+php-fpm. You can use a balancer (nginx/varnish/relayd or dns) to scale out.

  • Just have a small VPS for the database and two other VPS for a DNS Failover setup then use extns.com and it's pretty self explantory.

  • Hm, with the knowledge of today, I would stay on a dedicated machine - but no 300$ one. I think a machine under 100$ is enough.

    Apache is not as bad as everybody says, but not good as the other people are saying :P

    If you know what you are doing, it is possible to handle a lot of hits. Say to him, that he might install xcache? That brings about 300-400% more performance!

  • @Amfy said: Say to him, that he might install xcache? That brings about 300-400% more performance!

    I still think APC > xCache > eAccelerator; I guess it comes down to personal preference.

  • APC or another opcode cache is a must for any PHP site.

    Thanked by 1tux
  • AFAIK APC will come bundled in PHP 6? Or what was going to be PHP 6 at least.

  • @dmmcintyre3 said: APC or another opcode cache is a must for any PHP site.

    Agree with this.
    Probably the easiest cache to install. And probably the best? :P

  • @Roph said: AFAIK APC will come bundled in PHP 6? Or what was going to be PHP 6 at least.

    Yes, APC is providing PHP6 compatibility; plus they're a really active project.

  • Alright so lets assume I'm getting two or four VPS for DNS (each at a different provider), four webserver VPS and 1 larger mysql VPS. or maybe I should have him use a dns service? The goal is to make the system fail proof...

  • @BlueVM said: Alright so lets assume I'm getting two or four VPS for DNS (each at a different provider), four webserver VPS and 1 larger mysql VPS. or maybe I should have him use a dns service? The goal is to make the system fail proof...

    Probably just use a DNS service. What if your MySQL VPS goes down? Not really a fail proof system :P. Might want to set up MySQL replication.

  • @Kairus - Good point... are there any free dns services that would randomly cycle through a list of IPs for the webserver and check to see if they're online regularly?

  • @BlueVM said: four webserver VPS and 1 larger mysql VPS.

    Why would you need 5 separate VPS for this? Are these VPS's all located in different places?

  • BlueVMBlueVM Member
    edited February 2012

    @AsuraHosting - That'd be the goal... one VPS at each of the major low end providers or what have you. This way if one of them or a few of them have a network issue or something happens the site will still be online.

  • KairusKairus Member
    edited February 2012

    @BlueVM said: are there any free dns services that would randomly cycle through a list of IPs for the webserver and check to see if they're online regularly?

    You mean like round robin DNS? Any DNS provider should be able to offer you the ability to configure it.

  • @karius - Yes. Sorry, I've never used a dns service... I've relied on bind for most of my work.

  • @BlueVM said: @AsuraHosting - That'd be the goal... one VPS at each of the major low end providers or what have you.

    Oh... why aren't you using your own servers?

  • Currently my friend doesn't host with me... but I would probably use on of my own servers for some of his VPS. He's just tired of putting up with all the crap and wants a 100% fail proof system, which I understand.

  • @BlueVM said: He's just tired of putting up with all the crap and wants a 100% fail proof system, which I understand.

    Ah alright, that's understandable.

  • prometeusprometeus Member, Host Rep

    Please make sure to have a low latency/reliable path between mysql and php, else you are going to add some overhead connection side.

    S.

  • @prometheus - Alright so probably choosing providers on one coast as opposed to scattering them across the US or the UK. Good point.

  • NarutoNaruto Member
    edited February 2012

    I had a similar issue like this but finally resolved it. Here is my current setup:

    Three 1024mb VPSes serving traffic. One 256mb VPS for MySQL.

    Each VPS is on a separate node but with the same provider.
    (load balancing and fast connectivity to mysql from each vps)

    MaxClients/ServerLimit capped at 100 and MaxSpareServers at 90.
    (for keeping things contained and handling traffic spikes)

    On my provider, I have 8 cores at 3.16GHz each on each traffic VPS.
    (you don't need this much but it's nice)

    For PHP sessions I have rotating numbered subdomains.
    (round robin DNS will lose your PHP sessions; syncing them is too exhaustive.)

    Users go to 1.mysite.com, 2.mysite.com, and 3.mysite.com in order as they arrive.
    (using a custom made PHP script that checks the database for the last used server)

    My provider lacks Private IPs but gives me free bandwidth on my MySQL VPS.

    I get all this for a straight $45 a month, but I also used a lifetime discount promo.

  • @Naruto said: For PHP sessions I have rotating numbered subdomains.

    Another workaround could be to configure the PHP app to store the sessions in the database

  • But you can't get a 100% fail proof system. If you could get different vps on different provider yes this would be 100% fail proof but you can't do that. Do a ping to any datacenter from another datacenter. You will get 20-30 ms minimum if you are lucky and add replication to at least another MySQL server... and the actual request. You will get awfull performance.

    Try to get a deal with a provider, make sure that your VPS are at least on 2 differents internet provider and on different node. You need at least 2 VPS for MySQL (on different node too). The only problem is the IO performance, you need a good IO for all your MySQL server.

    You should also switch all your php session to MySQL (read that article, http://www.tonymarston.net/php-mysql/session-handler.html ). That way even if a server crash, the session will still on MySQL.

  • AdamAdam Member
    edited February 2012

    Below is how I would setup the site:

    - Two locations
    - 3 servers in total (2 in main location, 1 as backup in another DC)
    - Good networking between the two locations (same uplink providers)
    - Use a third party DNS with failover
    
    Location 1:
    - 1 x Web server with Nginx/PHP-FPM/APC
    - 1 x MYSQL server (Replication -> master)
    - Private network between the two servers
    - Store sessions via MYSQL (only if using replication)
    
    Location 2:
    - 1 x Backup web server and MYSQL (all in one + Replication -> slave)
    
    
    * Location 2 would be a read only backup (not promoted to master). This cures a lot of the problems while promoting and syncing master/slave.
    
    ** When Location 1 goes down (ping or HTTP), failover would switch to the backup server which you would then have a header notification announcing the site is under maintenance and is in "read-only" mode. (As a coder, it wouldn't be hard to edit the site to follow the read only rules).
    
    *** Depending on the size of the database I might even suggest doing regular interval dumps and syncing them with the backup.

    While it may not be 100% failover (as the backup is read-only), it should give the site enough redundancy.

  • @AsuraHosting said: nGinx + PHP FastCGI, configure to use sockets instead of :9000. It would be able to handle a lot of traffic/requests, and keep resource usage minimal.

    Trully, the usage of sockets with nginx and php5 lead me to a very bad performance problem (http://www.lowendtalk.com/discussion/131/cherokee-nginx-bsd-sockets).
    Have you tried to siege an nginx with php on bsd sockets?

  • BSD sockets != UNIX sockets ???

  • @Steve81 said: Have you tried to siege an nginx with php on bsd sockets?

    Nope, I've only used UNIX Sockets. And they work absolutely amazing.

Sign In or Register to comment.