How do I troubleshoot memory and CPU issues in Elastic Beanstalk?

2 minuto de leitura
0

I want to know why my AWS Elastic Beanstalk CPU and memory usage is too high, and I want to troubleshoot issues.

Short description

To gain insight into your Elastic Beanstalk CPU and memory usage and troubleshoot issues, do the following:

  • Configure the environment to collect metrics on memory and CPU usage
  • Analyze log files to troubleshoot memory and CPU usage issues

Resolution

Configure your environment to collect metrics

To gain insight into memory and CPU usage, do the following:

Analyze your log files to troubleshoot your memory and CPU issue

After gathering data from your metrics, do the following:

  1. Review the log files from the instances in your Elastic Beanstalk environment.
  2. Analyze key log files (such as /var/log/messages), and then search for messages about high CPU or out-of-memory (OOM) events.
  3. Use your log file results to figure out why the process is consuming a high amount of CPU or memory.
    Note: For example, you might find a large number of requests in Apache access logs or NGINX access logs.

If the issue is ongoing, then do the following:

  1. Connect to your Linux instance using SSH.
  2. Use the Linux top or free command to view details on CPU and memory consumption.
  3. Configure the ATOP monitoring tool. Review CPU and memory utilization stats.
  • CPU-based command: atop -C
  • Memory-based command: atop -m

If you don't find any errors, then the traffic load to your environment might have increased. To handle increased traffic, try the following:

  1. Scale up by increasing the instance type.
  2. Scale out to decrease the load per instance by increasing the size of the environment's Auto Scaling group.

AWS OFICIAL
AWS OFICIALAtualizada há um ano