Lightsail Instance Freezing

0

I have a Lightsail instance with 1GB RAM and 2 CPUs, it's running Ubuntu 22.04, Docker, and 3 containers for web development and testing (MySQL, Cloudflare Tunnel, and a small web app). It's been running for a few weeks now and it has crashed twice where the virtual machine is unresponsive. Trying to view the web console just shows a black screen. Rebooting the instance restores it to working for the moment. How do I determine the cause of this issue and prevent it from happening?

asked 2 months ago77 views
3 Answers
1
Accepted Answer

After further investigation I found that Ubuntu does not create any swap file by default and, therefore, it makes sense that the system would crash if memory usage hits max capacity. I have now created a swap file for my machine and will continue to monitor to see if this resolves the issue. I suspect it will.

answered 2 months ago
profile picture
EXPERT
reviewed a month ago
  • It has now been a while since creating the swap file and I've confirmed that the system is no longer freezing. Creating a swap file fixed the issue and this makes sense, I was just unaware that Ubuntu did not have a swap file by default.

0

It might well be the case that there are some CPU spiker making the instance unstable. Monitor CloudWatch metrics like CPU utilization, memory usage, and network traffic to identify what is causing the spikes. The CloudWatch agent can help with this.

Check for any processes running on the instance that may have memory leaks or are consuming excessive resources over time.

Verify application configuration and resource usage to ensure it can handle the expected traffic levels.

Consider upgrading to a more powerful Lightsail instance tier if the workload demands higher resources.

As a last resort, migrate the application to EC2 where you have more control over resources and scaling options if needed to handle spikes.

profile picture
EXPERT
answered 2 months ago
  • Thanks for the reply. I'm inexperienced with Linux. Can you tell me how to view logs about when the crash may have occurred and perhaps more details? I also suspect it's RAM or CPU usage hitting a limit but would that cause the whole OS to crash normally?

0

Hi, there, There are several instance metrics available such as CPU utilization and Burst capacity, you can find out details about these metrics from this doc: https://docs.aws.amazon.com/lightsail/latest/userguide/amazon-lightsail-viewing-instance-health-metrics.html

Also, Lightsail instances provide a baseline amount of CPU performance and have the ability to temporary burst the performance. If you used up all your CPU burst capacity, your instance will no longer be able to burst the performance. Check this doc for more details about Lightsail instance burst capacity: https://docs.aws.amazon.com/lightsail/latest/userguide/amazon-lightsail-viewing-instance-burst-capacity.html

Thank you

AWS
yujie
answered 2 months ago
  • Thank you for that information. I understand how the cpu utilization may reach some capacity and slow things down perhaps. Or perhaps RAM capacity could reach a limit. But should those limits cause the server to crash or just slow down until they can catch up?

    I suspect it’s most likely RAM usage. Is there a swap file or virtual memory by default that would help out if going over available memory? How would I check that configuration?

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