Skip to content

MY INSTANCE STOPS RESPONDING.... EVERY FIVE MINUTES....

0

I have running a nestJs and PostgreSql database inside an ec2 t3.small instance...

But it is stopping everytime, freezing and requests do not responds!!! and the value of charging keep growing, but the quality of service is very poor! what can i do to raise the speed of responses and to have avaiable this service when i need ?

When i used it in Sao Paulo it used to respond easier... but i was told to put this new instance in virginia....

asked 2 years ago258 views

1 Answer
0

I understand your frustration with the EC2 instance stopping and freezing frequently. Based on the information you've provided, there are a few potential issues and solutions to consider:

  1. Instance Type: You're using a t3.small instance, which is a burstable performance instance. These instances have a baseline level of CPU performance with the ability to burst above that baseline. However, if you consistently need more CPU power than the baseline provides, you may exhaust your CPU credits, leading to performance issues.

  2. Resource Utilization: Your NestJS application and PostgreSQL database may be consuming more resources than the t3.small instance can handle consistently. This could lead to high CPU usage or memory exhaustion, causing the instance to become unresponsive.

  3. Region Change: Moving from São Paulo to Virginia might have introduced latency issues, depending on where your users are located. This could contribute to perceived slowdowns.

To improve the situation, consider the following steps:

  1. Monitor Resource Usage: Use Amazon CloudWatch to monitor your instance's CPU utilization, memory usage, and CPU credit balance. This will help you understand if you're consistently exceeding the instance's capabilities.

  2. Upgrade Instance Type: If you find that you're consistently using more resources than a t3.small can provide, consider upgrading to a larger instance type or switching to a compute-optimized instance (c-series) that doesn't use CPU credits.

  3. Split Services: If possible, consider running your database on a separate instance optimized for database workloads (like RDS for PostgreSQL). This can help distribute the load.

  4. Optimize Application: Review your NestJS application for any performance bottlenecks or inefficient database queries that might be causing high resource usage.

  5. Auto Scaling: Implement an Auto Scaling group to automatically add more instances during high-demand periods.

  6. CloudFront: If your application serves content to users globally, consider using Amazon CloudFront to cache and distribute content, reducing latency.

  7. Alarms: Set up CloudWatch alarms to notify you when the instance is approaching resource limits or when it becomes unresponsive.

By implementing these measures, you should be able to improve the stability and responsiveness of your service. If problems persist after these changes, you may need to perform more in-depth application profiling or consider architectural changes to better handle your workload.

Sources
I have a problem with ec2 instance. | AWS re:Post
Instance stop working | AWS re:Post
AWS instance intermittently unresponsive behavior | AWS re:Post

answered 2 years ago

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.