Webapp infrastructure setup

Discussion in 'Site & Server Administration' started by velnox, Jan 17, 2013.

  1. #1
    Hi,

    I am planning on launching a productivity software for task management and it will be Software as a Service.

    I am wondering the type of infrastructure i need to implement to accommodate 10K users, and perhaps 100 - 1000 concurrent connected user.

    The software will be Javascript running on the client with back end of PHP/MYSQl. So people will be working on their tasks on the browser and when they make a change to a task an Ajax call will update the database.

    I am considering VPS as a starter, perhaps moving to Dedicated and maybe amazon ec2.

    What i have in mind for the VPS is:

    1x webserver 1Gb ram Duel core
    1x Mysql Master for Write 2Gb ram
    1x Mysql Slave for read 2Gb ram
    and Amazon S3 for File attachments.

    Maybe i should use a HA proxy for load balancing and memcache.

    Now would that kind of setup be sufficient for smooth operation for the users? and would it be scalable for future growth?

    I would really appreciate your insight.

    Thank you
     
    velnox, Jan 17, 2013 IP
  2. zacharooni

    zacharooni Well-Known Member

    Messages:
    346
    Likes Received:
    20
    Best Answers:
    4
    Trophy Points:
    120
    #2
    My suggestion:

    - 1x Dedicated Server (DB server) -
    4G RAM to start (make sure it's expandable to at least 12G)
    MySQL with InnoDB support, will help you in the long run, otherwise you'll run into lock wait
    Quad Core CPU
    HD space won't be as much of an issue, unless you're planning to store attachments, but to start, 4x500GB SATAII drives in hardware RAID10. This will dramatically boost performance, and keep it that way under load.
    100Mbit connection w/ 1Gbit private network - Since this is a database server, you will want to run remote DB queries over a private link, and firewall off all IPs except your own from the public interface on this server, so you can login and make backups, etc. Be sure to block egress communication as well except for your datacenters DNS resolver.

    - 2x VPS (Web servers) -
    2G ram each
    40-50G HD space
    100mbit link
    I would recommend Debian 6.0 (squeeze) 64-bit, mainly because if it doesn't run cPanel, it will have plenty of memory to run NGINX/PHP-FPM. Recommend that you run PHP-FPM in UNIX socket mode, which will shave a bit of overhead off your response times.

    - DNS Setup -
    Setup your domain A record to look like:

    domain.com. 300 IN A VPS.1.IP.ADDR
    domain.com. 300 IN A VPS.2.IP.ADDR
    www 300 IN CNAME domain.com.

    Having a RR (Round Robin) DNS will split the request load to two servers, this is called horizontal scaling. Set up NGINX to listen on port 80 (and optionally 443), and set your mysql_connect() lines in your code to query the DB server on it's private network IP.

    - Query optimization -

    Stray from broad SELECT queries, for example:

    Instead of using:

    SELECT * FROM news WHERE public=1;

    If you only need a certain column in order to find the information you seek, only use those columns in your query to limit the search, so for example:

    SELECT id,link,title FROM news WHERE public=1 LIMIT 10 ORDER BY id DESC;

    The rest you'll have to either study some howto's, or hire someone such as myself to setup and implement this for you. There's lots more to it, but I can't give away all of my know-how for free! Good luck, and I hope your service is successful.
     
    zacharooni, Jan 20, 2013 IP
  3. concerto49

    concerto49 Greenhorn

    Messages:
    83
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    10
    #3
    Make sure that the VPS' are on different physical servers to reduce risk of them all dying at the same time.
     
    concerto49, Jan 22, 2013 IP
  4. signorm68

    signorm68 Well-Known Member

    Messages:
    984
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    108
    #4
    If you use nginx for web serving and sphinx for search than your hardware will be OK for 10K concurent users.
     
    signorm68, Jan 29, 2013 IP