Skip to content

Reported memory usage discrepancy between Elastic Beanstalk and EC2

0

Elastic Beanstalk is reporting health issues with a service showing 90%+ memory usage for an EC2 instance. On the same EC2 instance's Monitoring page, mem_used_percent is at a steady ~81%, which is consistent with what the top command shows on the instance. We have alerts based on environment health, so we're alerted when memory hits 90% for the Beanstalk, but otherwise memory functionally is at 81% for the instance.

What's the reason for this discrepancy? How can it be mitigated?

  • Hi, I was having issues too with understanding how the memory usage was calculated by the Enhanced instance health because the free memory that I was seeing was not matching the alert on the memory.

    From a practical point of view It should be using the avail Mem top command value (which is not the same as the free memory) because running the calculation in my case matches exactly the percentage shown in the alert.

asked 2 years ago264 views

2 Answers
1

The discrepancy seen with the metric mem_used_percent via CW agent(on Beanstalk Instances) for Used Memory is because Cloud Watch agent will pass the values through a formula before reporting the values.

The formula used is:

Used Memory = MemTotal – (MemFree + Buffers + Cached)
mem_used_percent = (Used Memory/MemTotal) * 100.

Here the values for MemTotal, MemFree, Buffers and Cached are retrieved from /proc/meminfo

This value will be different as its not solely Used Memory as in the free -m output or top output but a calculation that accurately determines Memory usage of a Linux Machine.

AWS
SUPPORT ENGINEER

answered 2 years ago

  • Can you please provide the formula that is used for the calculation in Elastic Beanstalk, too ? Thank you.

-1

The discrepancy seen with the metric mem_used_percent via CW agent(on Beanstalk Instances) for Used Memory is because Cloud Watch agent will pass the values through a formula before reporting the values.

The formula used is:

Used Memory = MemTotal – (MemFree + Buffers + Cached)
mem_used_percent = (Used Memory/MemTotal) * 100.

Here the values for MemTotal, MemFree, Buffers and Cached are retrieved from /proc/meminfo

This value will be different as its not solely Used Memory as in the free -m output or top output but a calculation that accurately determines Memory usage of a Linux Machine.

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.