Ec2 instance is unresponsive

0

I have an ec2 t2.micro instance. Ubuntu 22.04 is running on it. I have setup a wordpress website on this server. Some times my server just become unresponsive. When it happens my website does not load , FTP , SSH nothing work. To solve this issue , I just stop and start the instance and it starts working again. When It happens , On EC2 dashboard It shows Connectivity Check fails . CPU usage credits are still available when i check Monitor tab. Can some one please help me to fix this issue?

Ankur
已提问 10 个月前237 查看次数
2 回答
0

There are some troubleshooting guides available to help track down the problem. I think I would start by doing the following:

  1. Configuring EC2 Serial Console so that I can login when this happens.
  2. Install CloudWatch Agent to collect OS-level metrics
  3. Make sure I have a valid backup of the instance using Data Lifecycle Manager or something similar.
profile pictureAWS
专家
kentrad
已回答 10 个月前
0

My guess is your instance is running out of memory.

That's why it's fine at the start, but as the t2.micro has only 1GB of memory (which isn't a lot) your application may be trying to consume a little bit more memory, and then a little bit more, until it tries to use more memory than is available. It's here that the Linux memory manager comes into play, and will try to swap processes out of main memory and onto disk (it's more complicated, but that's the general gist of it). This in itself is CPU-intensive, and as free memory gets less and less the memory manager will spend more and more of its time (and more and more CPU) trying to free up pages of main memory, leaving fewer and fewer CPU cycles for anything else (including handling SSH requests for login).

I had a very similar issue once, same setup as you (t2.micro running Wordpress and Apache) which would run fine for maybe 2 or 3 weeks and then become unresponsive, and a reboot would bring it back (actually, a better fix was to restart Apache once a week).

Unfortunately the EC2 section of the AWS Console doesn't display metrics for memory use, so right away you can't prove this is what's happening to you. You'll need to setup CloudWatch agent to collect these https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/Install-CloudWatch-Agent.html

profile picture
专家
Steve_M
已回答 10 个月前

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则