dvirb
By:
dvirb

Web app with many images and dynamic data - optimal DO server setup ?

June 29, 2016 761 views
Getting Started Load Balancing LAMP Stack Scaling Ubuntu

Hello guys,

I am trying to consider an optimal DO server setup for a new dynamic web site (or web app) that will display many images (small and medium), in addition to loading dynamic data from mysql, users are able upload their own images from their client area - which are then being displayed on the public web site.

I am using PHP + MySQL primarily.

I want to have high performance (fast loading speed) and optional (easy) future scaling abilities - but I am also on a small budget.

What's the optimal configuration ?

I was thinking to start with:

x1 $5 server as an app VPS
x1 $5 server as a database VPS
x1 $5 for a dedicated image VPS

So I can split the loads into separate entities (each server handles a different aspect mostly)

I expect about 60-120 max simultaneous connections at the beginning , and about 4-8 thousands of visitors per day - at the beginning.

I thought that could be a simple, yet powerful configuration for a start on a low budget since I can up each one of the servers to get more power if I need it (without adding fancy LB configuration) - and if I ever need a HA configuration I will get to that when it happens.

another option I thought about if I will configure a HA configuration is:

x1 $5 droplet for load balancer
x2 $5 droplet for for app + database

that way I have data replication which is nice, and already have the LB setup so I can add more servers later with ease, but I have no dedicated image or database server.

what do you think ?

Any help will be appreciated.

Thank you!

1 Answer

Estimating the resources required for a specific site and audience is never an easy task. There are many factors that come into play and the only way to really know for sure is to deploy and load test a configuration to see how it performs. That being said I can provide a couple suggestions:

1.) If you plan to run a MySQL/MariaDB service on a 512MB droplet you will want to spend some time optimizing your settings. The MySQL service has been known to exhaust the available memory on this size droplet (this is the reason that our WordPress image requires a 1GB droplet) and since droplets do not include swap space by default, running out of memory can result in your database service crashing.

2.) When you're first starting out, if cost is a concern you could likely use CloudFlare's free service in front of your droplets rather than implementing a more robust load balancing service. While a load balance will provide additional redundancy CloudFlare's CDN and caching will significantly reduce the load on your droplets.

Have another answer? Share your knowledge.