Skip to content
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

Add option to subtract ARC/ZFS cache from total memory usage #1297

Open
1 task done
Tahinli opened this issue Sep 10, 2023 · 14 comments
Open
1 task done

Add option to subtract ARC/ZFS cache from total memory usage #1297

Tahinli opened this issue Sep 10, 2023 · 14 comments
Labels
feature Requests for a new feature.

Comments

@Tahinli
Copy link

Tahinli commented Sep 10, 2023

Checklist

What operating system and version are you using?

Linux Mint 21.2 Cinnamon

What architecture are you using?

x86_64 / AMD64

What terminal(s) are you running bottom on?

alacritty

What version of bottom are you running?

0.9.6

How did you install bottom?

Cargo

Describe the issue

I don't know which one is right, but htop and bottom show different ram usages.

Screenshot from 2023-09-11 02-30-56

What is the expected behaviour?

They should be same.

What is the actual behaviour?

They are not same.

How can we reproduce this?

I don't know

Additional information

No response

@Tahinli Tahinli added the bug Something isn't working the way that is expected. label Sep 10, 2023
@ClementTsang
Copy link
Owner

ClementTsang commented Sep 10, 2023

Hm, in htop, would it be possible for you to enable the Memory [Text] meter?

But yeah that's weird, it looks fine if I bring them both up on my machine, in that the two match fine (btm 0.9.6, htop 3.2.2):

image

I'll take a look though.

@ClementTsang
Copy link
Owner

Also could you run free -mh, and paste the results? Thanks!

@ClementTsang
Copy link
Owner

Hm, was just checking around, and noticed that sysinfo just patched a bug around memory retrieval - let me bump the dependency and get a build out.

@Tahinli
Copy link
Author

Tahinli commented Sep 10, 2023

Here text
Screenshot from 2023-09-11 02-46-10

here free -mh
Screenshot from 2023-09-11 02-47-03

and here linux mint system monitor

Screenshot from 2023-09-11 02-47-20

@Tahinli
Copy link
Author

Tahinli commented Sep 10, 2023

Hm, was just checking around, and noticed that sysinfo just patched a bug around memory retrieval - let me bump the dependency and get a build out.

yeah should be something like this because my computer doesn't make me feel like i'm using 26gb ram lol.
I know what kind of programs are working and potentially how much ram should be consumed.

there should be something because even free -mh says I'm using over 20gb

@ClementTsang
Copy link
Owner

Thanks! And yeah, it... actually looks like btm matches closer to what free and the system monitor report, so I'm not sure if that means htop is calculating things differently here...

I do notice you're running VMs, I wonder if that's causing something weird to happen. But yeah let me get that sysinfo bump out and run a nightly build.

@Tahinli
Copy link
Author

Tahinli commented Sep 10, 2023

Thanks! And yeah, it... actually looks like btm matches closer to what free and the system monitor report, so I'm not sure if that means htop is calculating things differently here...

I do notice you're running VMs, I wonder if that's causing something weird to happen. But yeah let me get that sysinfo bump out and run a nightly build.

btw i closed vm and tried again. still same. and actually even if it running i just gave it to 2gb ram

@ClementTsang
Copy link
Owner

Thanks, that rules that out at least. Some other questions:

  • Could you send a screenshot of top?
  • Are you using ZFS?

@Tahinli
Copy link
Author

Tahinli commented Sep 11, 2023

I killed vm and took screen shot
Screenshot from 2023-09-11 02-59-03

if i'm not wrong, yes i'm using zfs
Screenshot from 2023-09-11 03-01-36

@ClementTsang
Copy link
Owner

ClementTsang commented Sep 11, 2023

Ah, yeah, that explains it - tools like free do not remove the ARC (ZFS cache) usage from total memory usage, while tools like htop do. This matches your above screenshot - in bottom, 19.76 GiB - 15.5 GiB = 4.26 GiB which is about what htop is showing.

If you don't mind, I can turn this report to a feature request to add a config option to allow you to enable/disable this. Wouldn't be too hard... I think.

@Tahinli
Copy link
Author

Tahinli commented Sep 11, 2023

Ah, yeah, that explains it - tools like free do not remove the ARC (ZFS cache) usage from total memory usage, while tools like htop do. This matches your above screenshot - in bottom, 19.76 GiB - 15.5 GiB = 4.26 GiB which is about what htop is showing.

If you don't mind, I can turn this report to a feature request to add a config option to allow you to enable/disable this. Wouldn't be too hard.

yeah sure, actually this makes me happy.

@Tahinli
Copy link
Author

Tahinli commented Sep 11, 2023

but as a question, technically which one is right. included zfs cache or not ?

I mean if countinue to allocate memory with some heavy programs, am i going to be allowed or my system going to crash / kill process

@ClementTsang
Copy link
Owner

ClementTsang commented Sep 11, 2023

From what I remember (my understanding of ZFS is only rudimentary though!) if memory is needed by the rest of the system then the memory used by the ZFS cache ends up getting reclaimed as needed, so it shouldn't affect your system.

And as for which one is correct, they're... well, kinda both right in this case. It depends what the program creator wants to represent. free/top (and currently, btm) all represent it as part of the usage, while htop chooses to not represent it as they believe that's more accurate. In this case, you could definitely argue for both (hence why I would rather just make it configurable).

@ClementTsang ClementTsang changed the title Different Ram Usage ? Add option to subtract ARC/ZFS cache from total memory usage Sep 11, 2023
@ClementTsang ClementTsang added feature Requests for a new feature. and removed bug Something isn't working the way that is expected. labels Sep 11, 2023
@jamartin9
Copy link
Contributor

jamartin9 commented Sep 13, 2023

I mean if countinue to allocate memory with some heavy programs, am i going to be allowed or my system going to crash / kill process

if memory is needed by the rest of the system then the memory used by the ZFS cache ends up getting reclaimed as needed, so it shouldn't affect your system.

OOM killer may be invoked if ARC does not free memory fast enough. If your workload allocates a lot of RAM quickly (vms/games/etc) some zfs properties like zfs_arc_sys_free/zfs_arc_max/etc should probably be configured.

I am unsure of how the UI will handle the arc max changes if it is done dynamically with respect to the time scrolling...

(htop can also be setup to display ARC meters. Apologizes if this is off topic)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Requests for a new feature.
Projects
None yet
Development

No branches or pull requests

3 participants