High CPU usage on AWS Elastic Beanstalk after updating platform version

0

Currently we are running on "Puma with Ruby 2.6 running on 64bit Amazon Linux/2.12.15", but it's already deprecated so we replicated the environment and tried to upgrade to "Ruby 3.0 running on 64bit Amazon Linux 2/3.6.10", the new version is running on ruby 3.0.6 with rails 6.1.6 and puma 6.3.0. After finishing all the upgrades we managed to start the testing of the new environment but we are facing a problem with a high cpu usage that it's not normal, every time we make a request the cpu spike to 100% and the request takes 20x times longer than normal (probably because of the cpu getting bottlenecked).

Anyone knows what could be causing this problem?

Thanks in advance.

Kadu
asked 9 months ago477 views
1 Answer
0

The high CPU usage you're experiencing might be due to a variety of reasons. Let's try to troubleshoot this issue:

  • Check for application-level issues: Your application code or the libraries you're using may not be fully compatible with Ruby 3.0.6 or other changes in the new environment. You may want to check your application logs for any errors or warnings.
  • Memory Swapping: High CPU usage can also occur if your instance is running out of memory and starting to swap. Check your memory usage in the AWS Management Console and, if needed, consider upgrading your instance type to one with more memory.
  • Inefficient database queries: Inefficient database queries can often cause high CPU usage. Check your database logs for slow queries and optimize them if necessary.
  • Inefficient code: It's possible that certain operations in your code are more resource-intensive in Ruby 3.0.6 compared to Ruby 2.6. Profiling your application might help identify any problem areas.
  • Concurrency issues: Since you're using Puma, which is a multithreaded server, you may want to examine your thread settings. If the number of threads is set too high, it can lead to excessive context-switching, leading to high CPU usage.
  • New version issues: There might be some unknown issues with the "Ruby 3.0 running on 64bit Amazon Linux 2/3.6.10" platform itself, causing higher CPU usage. Consider reaching out to AWS support to see if there are known issues.

Without more specific information, it's hard to provide a more accurate answer, but these are some general areas to consider. You may need to perform more extensive profiling and logging to isolate the cause of the high CPU usage. Remember that upgrading both the Ruby version and the underlying platform can introduce many changes, any of which might be contributing to the problem.

profile picture
answered 9 months 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.

Guidelines for Answering Questions