recently I learned how to setup load balancer using aws and direct it to root / sub domain.
But while playing around with it, I figured there are some delays. For example, my settings are
3 instances, using nginx
, node
, with pm2
I changed the html
content for each instances such as <h1>load 1</h1>
<h1>load 2</h1>
<h1>load 3</h1>
then when I keep reloading the load balancer dns, it does show the instances are switching randomly so I know that it's working.
then I went into one of the instances, stop the pm2
I went to refresh my page again, sometimes it would show gateway error
which I believe it's because it went into the instance that I stopped, sometimes it would show the page BUT with super bad css that when I open console.log, there will be tones of errors saying cannot locate file.
Takes like 1-2 minutes until everything is totally fine.
I am wondering if this is normal and how it should happen? Or there is a way to optimise it in order for user to have a better user experience?
Thanks for any advise.