-
Notifications
You must be signed in to change notification settings - Fork 60
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Inaccurate RAM usage detection with ZFS #125
Comments
Thanks for the detailed report! Currently the It seems this just take Since some user may care about the
|
Hey, thanks for the quick action! Sadly I have to report that this didn't help in my specific case. As you can see here, it still thinks that my Server is on 90%+ RAM usage: And just for sanity checking, at the same time, btop reports: This is a very ZFS-specific issue, though, and I assume not an issue for most users. I did some more research and this issue seems to be with the fact that most filesystems just use the linux built-in file caching, which the kernel can properly differentiate between available and used. The only way I've found to work around this seems to be having the application itself manually check the ZFS ARC memory and subtract it - there doesn't seem to be a way to get this info just from built-in commands that only check the kernel, as the kernel doesn't know about ZFS-internals. I've found this which gives some valuable hints: https://superuser.com/a/1137417 The most valuable part of the output seems to be the fields c, c_min, c_max and size.
However, the answer doesn't explain "available" memory for ZFS could be calculated as Using awk the values can be extracted in gigabytes like this (The output from arcstats is initially in bytes, the Given that, the available memory for a machine could be calculated as: Of course, it would be reasonable to first check if zfs is in use (by checking if |
Hello,
first off I want to start this off with saying I absolutely love Komodo, it's by far the best Docker(-Compose) Deployment tool I've ever used! Thank you for this software!
Now to the issue, Komodo is persistently and non-stop giving me this Alert:
![firefox_jTM2U6ZByI](https://private-user-images.githubusercontent.com/38866264/376135653-df742438-7ce9-474a-83b0-77a7e1f8a7e9.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk0MTYxMDYsIm5iZiI6MTczOTQxNTgwNiwicGF0aCI6Ii8zODg2NjI2NC8zNzYxMzU2NTMtZGY3NDI0MzgtN2NlOS00NzRhLTgzYjAtNzdhN2UxZjhhN2U5LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTMlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjEzVDAzMDMyNlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTJkMDlhNTgxNjdmZTVhOTM5OWNmNTE1MTk3ZmQ2ZDhlOTVmMjdjYzdmZWEzODE2NzJmM2U0NDA5N2MwM2I5MTMmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.pfujOk0HVDCvmB_gHdBJmFljaT8ZBjASgF9Urnt2N3A)
I knew this was wrong and that I am not using this much memory, so I went to investigate.
![WindowsTerminal_zsEmIoDCvw](https://private-user-images.githubusercontent.com/38866264/376136291-d21ab8c8-7206-425b-8467-c01cb156a3e8.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk0MTYxMDYsIm5iZiI6MTczOTQxNTgwNiwicGF0aCI6Ii8zODg2NjI2NC8zNzYxMzYyOTEtZDIxYWI4YzgtNzIwNi00MjViLTg0NjctYzAxY2IxNTZhM2U4LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTMlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjEzVDAzMDMyNlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTY0ZjhiZWNjYjlmM2JkNTUzOTliOTU1YTEzYjYxZTUzZGU4MTUxNDBhOWExZjdjYjllMTg2OWYxNDEzNjg3YTEmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.CxKqmExst8jFZlkbd0JhY-2tL9sklgNY4Da_PNqy56c)
![ApplicationFrameHost_4vgqZXAHEi](https://private-user-images.githubusercontent.com/38866264/376136536-cbb58a85-4ce0-4dc0-86cf-69dd10e5fa2b.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk0MTYxMDYsIm5iZiI6MTczOTQxNTgwNiwicGF0aCI6Ii8zODg2NjI2NC8zNzYxMzY1MzYtY2JiNThhODUtNGNlMC00ZGMwLTg2Y2YtNjlkZDEwZTVmYTJiLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTMlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjEzVDAzMDMyNlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWMxY2E5NTczYWM4MDgwMmZhNDBkMzBlYjVkZjVhZWEyMzY2MjE3NTFhYjEwOGJhMDA4YjNlMzAwZmFmMTZkOGYmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.reO-pEpFLxxArTSJZYVw5bri0BWOIFFk-JYRE1-NzY8)
To my surprise
free -h
actually shows the same usage!Which at first had me worried, but then following this up by checking with htop and btop, they suddenly reported different (and more within reason) usages:
Following this I went to investigate and eventually found the reason for this discrepancy: ZFS, the file system
ZFS is very memory-intensive as it reaches higher capacities (and I have a total of 82TB of storage using ZFS) as it uses what's called ZFS ARC. This is a cache that is kept in-memory.
Just like normal Linux, ZFS ARC separates it's RAM usage into "Used" and "Available" - Used RAM being Memory that it actually needs, while Available Memory is Memory that is being used but ZFS can release to the user at any given time if needed.
(I'll assume you already know this topic, but if not, here's a small tl;dr: https://www.linuxatemyram.com/)
I confirmed this using btop which actually has a setting for this:
![WindowsTerminal_dhZYO4d5Jz](https://private-user-images.githubusercontent.com/38866264/376138371-324c622d-9710-406d-8a3e-4b7ba6d5b610.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk0MTYxMDYsIm5iZiI6MTczOTQxNTgwNiwicGF0aCI6Ii8zODg2NjI2NC8zNzYxMzgzNzEtMzI0YzYyMmQtOTcxMC00MDZkLThhM2UtNGI3YmE2ZDViNjEwLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTMlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjEzVDAzMDMyNlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTA4MzFiYTc2NjBhZGM1MjI5ZmE2ZTg2NzhhYjJlOWU3NTdhZDU3MThiY2VmNDM0MmI5NjY3MmU2OWYwMjAzYWMmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.-RcNINh_OllbK3SzoPMoR2WLKaKXjS5Qk93Rf9EFiA8)
While this is set to true, btop shows the "correct" RAM Usage of 64GB Used, 61GB Available.
Setting this to false makes btop reflect what Komodo and
free-h
show: 119GB used, ~6GB available.I double checked and with my other servers, where ZFS is not in use, Komodo correctly only considers the used RAM used, so this is confirmed to be a ZFS specific issue.
Generally speaking, Available RAM should be considered "free" RAM from a user perspective.
It'd be great if this behavior could be adjusted as otherwise I have an alert active 24/7, thank you :)
The text was updated successfully, but these errors were encountered: