AWS Lightsail seems to crash super easily
Asked Answered
F

1

5

I'm currently working on a wordpress website on AWS lightsail. Its very basic and I have just installed the oxygen theme to edit the site.

I am in one country and my friend (who I am doing this for) is in another country.

He logged into the site the same time I was editing it, and it caused this spike in the CPU usage:

enter image description here

This made the website not load in the browser and I could not even SSH using the web based SSH terminal.

That isn't a very big spike and I'm worried I set something up wrong. Is there anyway to see more information on this metric? or see more metrics as to why my instance went down?

Fluorosis answered 28/1, 2021 at 12:52 Comment(0)
U
15

Not related to cpu, but I had similar issues with Lightsail servers randomly becoming unresponsive. Try checking your swap space. There probably isn't any configured if you used the amazon images, and couldn't hurt to add some.

I used this set of commands here:

# first check if any
swapon -s

# then add some if not
sudo fallocate -l 1G /swapfile 
sudo chmod 600 /swapfile 
sudo mkswap /swapfile 
sudo swapon /swapfile 
sudo cp /etc/fstab /etc/fstab.bak 
echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab

Tweak the size if

Upstanding answered 10/6, 2021 at 17:0 Comment(2)
Buddy, this was exactly what my issue was. I would have never thought to check this! Usually default installs have plenty of swap space but these aws instances didn't have any. Swap: 0 0 0. Why on earth do they do this?? Swap space is basic linux 101 and one of the first things that is taught to those seeking linux certifications. I have been reconfiguring my php.ini, php-fpm and httpd.conf files trying to troubleshoot why my server goes unresponsive and here it is. Swap space. Thank you so much.Wilkens
This answer is still here helping frustrated developers! Thanks! (And why on EARTH doesn't AWS default the swapfile to at least a couple GB??)Telephoto

© 2022 - 2024 — McMap. All rights reserved.