Scaling your Lightsail Servers
Horizontal Scaling and Vertical Scaling are the two methods which you can use to support increased traffic on your web server.
Vertical scaling is simple you just increase the resources on your server so that it can support increased traffic. For Example, If you are using AWS LightSail $5 instance a day, and your traffic doubles, you would move to $10 instance. This is premise of Vertical Scaling you just add more resources to your server so that you can handle the extra traffic.
Horizontal Scaling includes additional servers behind a load balancer which helps you serve your website to more number of people. Let’s take the same example. If you are using AWS LightSail $5 instance and your traffic doubles, you add another $5 instance. There are now two $5 AWS LightSail instances which can handle your site requests and you can distribute the traffic to those servers using a load balancer.
One caveat here is if you are going to scale with multiple servers you will need to use shared resources like a file system for images/assets and a database so all the instances are getting the same data.
Here are a couple of example diagrams of Horizontal Scaling.
Which one is Better?
There is no correct answer. It depends on your situation and how much downtime you can tolerate. If anything goes wrong with a server using vertical scaling your whole site is down. This can be a traffic spike , a bad update, a misconfiguration almost anything. With the horizontal scaling, your other server can still serve your website or application. It might have to take more load and response time but your site is still up.
Any questions about your particular situation you can contact me through the chat before or schedule a call here:
Originally published at https://buildingbettersoftware.io on August 22, 2020.