cancel
Showing results for 
Search instead for 
Did you mean: 

magento 2 Lightsail load balancer second instance do not work

magento 2 Lightsail load balancer second instance do not work

I have this M2 store up and running in lightsail, not bitnami fully configured by me in ubuntu.

However, I haven't work in the redis, varnish part because I never done it before and was "working fine" but then the other day we got traffic over 1000 people and the CPU just couldn't handle it even with the highest lightsail tier 8core CPU 32 Ram. it just crashed for a minute.


So I notice the load balancer option, created an external DB linked M2 to it, made another instance from the latest snapshot. Added both instances to load balancer and got "healthy" status.

I thought everything was working fine. but then noticed in the metrics the new instance was not active at all. maybe the balancer was going to move traffic to it after the main instance started to raise traffic? but then one day we got high traffic and the main instance started to slowdown and the new stayed with cpu without activity so I realize there was no traffic moving to it.

I followed all the steps I found, but all the guides only talk about wordpress.


I need urgently to make my M2 stable for high traffic.

what step am I missing for M2 to have a stable load balancer?

3 REPLIES 3

Re: magento 2 Lightsail load balancer second instance do not work

Did you try to run some load test yourself and see if the traffics are being distributed fairly? 

 

This may be quite obvious but did you make sure to point your domain to the load balancer? If the domain is still pointed to the first instance, all traffic will only be directed there and that may explain the behavior you are seeing. 

 

You should definitely implement additional caching system like Redis and Varnish/LiteMage Cache in order to speed up your store and increase the amount of traffic that you can handle. 

 

Finally, do note that AWS Lightsail instances are basically EC2 t2 instances which run on a CPU Credit system (they call it "Burst Capacity" in Lightsail). If your CPU Credits run low, you will not be able to "burst" and thus will only have access to a limited amount of CPU, not the full 8 CPU Cores. 

Re: magento 2 Lightsail load balancer second instance do not work

I followed the guide and added a cname to the DNS record.

 

am wondering if the second instance needs some extra setup? because the second instance all system is pointing to the first instance where the IP, DNS records are.

 

I have external DB so both M2 are usign same DB. but still the DB is configured for the original instance, the second instance have their own IP. is this ok or not

Re: magento 2 Lightsail load balancer second instance do not work

From Lightsail's guide here:-

https://lightsail.aws.amazon.com/ls/docs/en_us/articles/add-alias-record-for-lightsail-load-balancer

 

You will need to point your domain's A record to the Load Balancer's "DNS name".