[SERVER-54770] Add /proc/meminfo MemAvailable to FTDC Created: 24/Feb/21  Updated: 29/Oct/23  Resolved: 10/Mar/21

Status: Closed
Project: Core Server
Component/s: Diagnostics
Affects Version/s: 4.4.4
Fix Version/s: 4.9.0, 4.4.5, 4.0.24, 4.2.14

Type: Question Priority: Minor - P4
Reporter: Kevin Arhelger Assignee: Mark Benvenuto
Resolution: Fixed Votes: 3
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Backports
Backwards Compatibility: Fully Compatible
Backport Requested:
v4.4, v4.2, v4.0
Sprint: Security 2021-03-22
Participants:

 Description   

When analyzing low memory / out of memory situations, currently a manual calculation for available memory is needed. As the Linux page cache will attempt to consume all available memory, the MemFree statistic alone cannot be used to perform this analysis.

Redhat 7 and later include a MemAvailable counter in /proc/meminfo https://www.kernel.org/doc/Documentation/filesystems/proc.txt

MemAvailable: An estimate of how much memory is available for starting new
applications, without swapping. Calculated from MemFree,
SReclaimable, the size of the file LRU lists, and the low
watermarks in each zone.
The estimate takes into account that the system needs some
page cache to function well, and that not all reclaimable
slab will be reclaimable, due to items being in use. The
impact of those factors will vary from system to system.

While a close approximation of MemAvailable can be made from simply summing MemFree + Cached + Buffers. I've found MemAvailable to be slightly more pessimistic and would be really helpful in providing a single metric for memory analysis.



 Comments   
Comment by Githook User [ 10/Mar/21 ]

Author:

{'name': 'Mark Benvenuto', 'email': 'mark.benvenuto@mongodb.com', 'username': 'markbenvenuto'}

Message: SERVER-54770 Add /proc/meminfo MemAvailable to FTDC

(cherry picked from commit 0cde744f93ba588956d13fafa9cd74b0ded9334a)
Branch: v4.4
https://github.com/mongodb/mongo/commit/39f7b1f7c7fae55184581b98d76158777a5a5a26

Comment by Githook User [ 10/Mar/21 ]

Author:

{'name': 'Mark Benvenuto', 'email': 'mark.benvenuto@mongodb.com', 'username': 'markbenvenuto'}

Message: SERVER-54770 Add /proc/meminfo MemAvailable to FTDC

(cherry picked from commit 0cde744f93ba588956d13fafa9cd74b0ded9334a)
Branch: v4.0
https://github.com/mongodb/mongo/commit/16e27da22758f0709cc6185899b181c77b9f28a4

Comment by Githook User [ 10/Mar/21 ]

Author:

{'name': 'Mark Benvenuto', 'email': 'mark.benvenuto@mongodb.com', 'username': 'markbenvenuto'}

Message: SERVER-54770 Add /proc/meminfo MemAvailable to FTDC

(cherry picked from commit 0cde744f93ba588956d13fafa9cd74b0ded9334a)
Branch: v4.2
https://github.com/mongodb/mongo/commit/6d39c7158261b7a7d1012c1a0a206b53d531f6fe

Comment by Mark Benvenuto [ 10/Mar/21 ]

Yes, I created the backports to 4.0, 4.2, and 4.4. I agree that we should not backport to 3.6.

Comment by Kevin Arhelger [ 10/Mar/21 ]

Thank you mark.benvenuto for working on this. This will greatly enhance our ability to diagnose memory issues.

Would it be possible to backport this to 4.0 and later? (With the imminent end of support for 3.6 I don't think its necessary for that version).

Comment by Githook User [ 10/Mar/21 ]

Author:

{'name': 'Mark Benvenuto', 'email': 'mark.benvenuto@mongodb.com', 'username': 'markbenvenuto'}

Message: SERVER-54770 Add /proc/meminfo MemAvailable to FTDC
Branch: master
https://github.com/mongodb/mongo/commit/0cde744f93ba588956d13fafa9cd74b0ded9334a

Generated at Thu Feb 08 05:34:26 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.