disk space and ram calculation are not correct  [SOLVED]

Have you discovered a bug? Tell us about it.
Post Reply
nobody
Posts: 11
Joined: Sun 8. Jan 2023, 22:29
Location: Universe
Contact:

disk space and ram calculation are not correct

Post by nobody »

Hi,

first of all, awesome work!
I've noticed in the admin area that the ram calculation doesn't include the cache so it doesn't show the actually free value but the free ram value without the cache.
E.g. with 4GB ram i have:
Free: 3.22 GB
Used: 622.80 MB
Total: 3.83 GB

but in reality it's (taken from the console, [ free -h]):

total: 3.8Gi
used: 634Mi
free: 2.7Gi
shared: 16Mi
cache: 557Mi
available 3.0Gi

Same for the disk space calculation, it doesn't include the tempfs, so the calc doesn't make much sense:
Free: 31.73 GB Used: 5.45 GB Total: 39.20 GB


If possible, please provide a fix.
Thanks a lot
User avatar
Florian
Keyweb AG
Posts: 1243
Joined: Wed 20. Jan 2016, 02:28

Re: disk space and ram calculation are not correct

Post by Florian »

What do you mean? Keyhelp shows the result of free + cache
Mit freundlichen Grüßen / Best regards
Florian Cheno

**************************************************************
Keyweb AG - Die Hosting Marke
Neuwerkstr. 45/46, 99084 Erfurt / Germany
http://www.keyweb.de - http://www.keyhelp.de
**************************************************************
nobody
Posts: 11
Joined: Sun 8. Jan 2023, 22:29
Location: Universe
Contact:

Re: disk space and ram calculation are not correct

Post by nobody »

Florian wrote: Sun 8. Jan 2023, 23:22What do you mean?
"Free" RAM means it's "free", there's no cached stuff on it, no processes running, nothing.
If something is cached on RAM, it's not free. It's like that since RAM has been invented.
Otherwise it should be renamed in "free + cached", but naming it "free" while it's not free is confusing;
somebody may think you have +/- 500 MB more RAM while it's occupied.

If you turn on some programs relying heavily on RAM cache it still shows me the same free RAM.

Same for HD space:
On the dashboard i see: Free: 31.73 GB Used: 5.45 GB Total: 39.20 GB
Basic math shows me that 39.20 - 5.45 = 33.75.
39.20 - 5.45 = 31.73 doesn't make sense.
User avatar
Alexander
Keyweb AG
Posts: 3810
Joined: Wed 20. Jan 2016, 02:23

Re: disk space and ram calculation are not correct  [SOLVED]

Post by Alexander »

Hello,

Results of "free -m"

Code: Select all

               total        used        free      shared  buff/cache   available
Mem:            7949        1990        1392          16        4566        5646
KeyHelp Toolbox:

Code: Select all

Free:  5.82 GiB     Used:  1.95 GiB     Total:  7.76 GiB
As you can see, KeyHelp uses the "free + buff/cache" as value for free. Linux uses a different terminology for free ram, than other operating systems. The "free + buff/cache" (alternative the "available" column) is the "human-readable" form of free RAM.
"RAM Cache" can be instantly freed if an application request so - you should not consider "cache" as "used" RAM.
Further reading: Help! Linux ate my RAM!

Same for the disk space calculation, it doesn't include the tempfs, so the calc doesn't make much sense:
The Diskspace shown on the Admin dashboard only take into account the main drive, which should normally be "/" (== the disk associated with). It does not show other disks on the system. If you are interested in those values, have a look into "System -> Disk Overview"

On the dashboard i see: Free: 31.73 GB Used: 5.45 GB Total: 39.20 GB
Basic math shows me that 39.20 - 5.45 = 33.75.
39.20 - 5.45 = 31.73 doesn't make sense.
You are aware that Linux reserves parts of the disk space for reserve and internal use? This disk space is neither used nor free. By the way you can have a look into the reserved amount also on the "System -> Disk Overview" page.
Mit freundlichen Grüßen / Best regards
Alexander Mahr

**************************************************************
Keyweb AG - Die Hosting Marke
Neuwerkstr. 45/46, 99084 Erfurt / Germany
http://www.keyweb.de - http://www.keyhelp.de
**************************************************************
User avatar
BasHeijermans
KeyHelp Translator
Posts: 158
Joined: Mon 20. Jun 2022, 12:01
Location: Heppen Belgium
Contact:

Re: disk space and ram calculation are not correct

Post by BasHeijermans »

Often made mistake.

Like Alex states, the cached memory is actually free, but code keeps being loaded just in case it's needed again.
But the code is not in use and can be freed at any time.

Because Linux works this way, applications that start again will work a lot faster then loading everything again at each start or reload.

It's kind of pointless to free all memory all the time, as that takes extra CPU-cycles, so the code keeps being loaded unless some other program needs memory, only then it's actually made free for other uses.
As such you can see 'little' free memory and a lot of cache.

For the system it doesn't make any difference what the value of the memory is, as it's refreshed from time to time anyway, regardless the content.
But loading and unloading memory costs CPU-cycles that could be used better to speed the system up.

In short, to have a lot of memory used by the cache is a good thing, it will make your system work faster :lol:
It won't mean you have less memory to work with.

The only bad thing you can have is when it starts swapping, then you run out of memory, and should be avoided at all times.
Greetings Bas.

Ik heb KeyHelp naar het Nederlands vertaald, contacteer me als er translatie fouten zijn.
(I have translated KeyHelp into Dutch, contact me if there are translation errors.)
Next version 24 of KeyHelp 100% translated.
Post Reply