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

Last updated: 2019-10-15

My CPU or memory usage is too high in my AWS Elastic Beanstalk application. How can I find out why, and then fix this issue?

Resolution

Configure your environment to collect metrics

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

Analyze your log files to troubleshoot your memory and CPU issue

After gathering data from your metrics, try 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 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 could find a large number of requests in Apache access logs or NGINX access logs.

If the issue is ongoing, try the following:

  1. Connect to your instance using SSH.
  2. Use the Linux top or free command to view details on CPU and memory consumption.

If you don't find any errors, then the traffic load to your environment could 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.

Did this article help you?

Anything we could improve?


Need more help?