one Lightsail 4gb instance vs 2 2gb instance with load balancer. which one perform better assuming memory 2gb is enough to run the website?


one Lightsail 4gb instance vs 2 2gb instance with load balancer. which one perform better assuming memory 2gb is enough to run the website? I have 5 website i need to move to amazon lightsail or ec2 I need guidance.

Go with 8gb ec2 or create small instances in lightsail. which is better.

Lightsail is good in a way that its protected. I mean one site go down dont affect each other because different static ips Amazon ec2 all sites will be on single instance. One email spam attack all goes down.

Any solution?

  • You can have similar setup on amazon ec2 as well and host different sites on different servers. If you put your server behind load balancers then you need to make sure the data is synced across all servers behind the load balancer.

asked 3 years ago458 views
1 Answer
Accepted Answer

Good question and I think that you already alluded to the answer.

Generally speaking, load balancing at low scale does not yield huge performance benefits. The comparison you are making here is appropriate because the larger of the two specs you are comparing is simply double: 2 vCPUs and twice the memory. You would think that performance under load would be similar between the two setups because you have double the CPUs and double the memory, but that all depends on if your application is configured to take full advantage of the CPUs and memory avaiable. In the case of CPUs that usually translates into increasing the number of worker processes. Same thing for memory, espcially if each worker uses dedicated memory. For memory it might require you to configure memory allocation config in your app.

Performance is only half the story, though. As you pointed out redundancy is a big plus of the load-balanced solution. I would argue that for any business-critical workload redundancy is more important that performance/efficiency.

To boil it down to a simple answer: You might be able to configure a larger server to be more efficient than two smaller ones, but you will sacrifice redundancy in the process. What I've always done is tuned my application for a relatively small footprint, made it stateless (*), and deployed it to multiple instances behind a load balancer, even for smaller deployments. This also has the added benefit of allowing you to develop the solution on a small, inexpensive instance and then deploy on the same instances (just more of them).

I hope this helps!

  • statelessness refers to a feature of the design where no requests require prior state on the server to succeed (like sessions or cached data).
profile pictureAWS
answered 3 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions