Memory is constantly used to 97%


(Uwe) #1

Nethserver 7.5 1804 final

Hello Nethserver friends,

I have a problem with memory usage. The available memory is used up to 234 MB, as you can see on the picture. Which command can I use to show the memory usage of each application?
Mail with Webtop, Nextcloud, Mattermost, Dokuwiki and Ejabberd are installed on the server.

Regards

Uwe

Unbenannt_2


(fpausp) #2

U can use the CLI Command:
top

A Guide to the Linux “Top” Command


(Jeroen Visser) #3

You sure that is an issue, and not just the limit of what the machine can handle, given the amount of web-apps you are running there ?


(Rob Bosch) #4

Remember that linux just will grab what it can use. If there is 8GB ram available, it will use it. It will become a problem if it constantly exceeds the available amount if ram and starts swapping.
https://www.centos.org/docs//2/rhl-cg-en-7.2/memory-usage.html


(Eddie Atherton) #5

Quite normal for Linux:

Linux Ate My Ram

Cheers.


(Juan Carlos Fernandez) #6

That’s not available memory, that’s free memory. I suggest you use atop and free -h to monitor your RAM.

Install atop:

yum install atop

Run atop:

atop 5

By default it will show your system process CPU consumption, to show RAM usage press key M and then SHIFT+M, this will show you a list of processes ordered by RAM, column RSIZE will give RAM usage by each process.

Also this command

free -h 

Will give your system available memory under column available, memory used will be total - available.
Also used column is sum of all process used memory, is not equal to total - available because system also use slab, buff, and other types of memory.


(Kirk Macdonald) #7

you can use a cron task to clear the ram caches, use at your own risk thou as it could cause issues im not aware of

I do indeed use this my self as centos loves to chew through my 64gb ram :rofl:

so set the cron job as a user with root privs and maybe set the cron to run at less busy times like 3am or so

sync; echo 3 > /proc/sys/vm/drop_caches


(Mark Verlinde) #8

Being an Arch Linux guy too i’m used to have a 100% memory usage. Arch Linux just tries to cash whatever it can and drops it if memory is allocated elsewhere. Why worry about it?

This being said I hope the new web-ui cockpit does a better Job than we have now. :wink:
Or should it be improved in the server-manager we have now?


(Ralf Jeckel) #9

You can use “statistics module” to show your memory-usage.

image

Most of the ram of this machine is cashed, so it’s available for use if needed, but used for chaching if not needed for apps. Following the priciple “unused (free) memory is useless memory”.


(Uwe) #10

Hi @ all,

Thank you for all the suggestions. Now I understand the problem better and know that this can be normal.

Regards

Uwe


(Mark Verlinde) #11

Sorry to all of you to persist a little bit more :grinning:

This question/issue comes around quite often. IMHO the cause is because the memory info on the dashboard is not very meaningful maybe even a bit misleading.
We have learned now memory management in linux is to complex to be shown in one simple bargraph.

However I think we can do a better Job:

The widget on the dashboard reads memory info from /proc/meminfo:

# cat /proc/meminfo
MemTotal:         949416 kB
MemFree:           70744 kB
MemAvailable:     462104 kB
Buffers:           26540 kB
Cached:           324136 kB
SwapCached:         2120 kB
Active:           363876 kB
Inactive:         342868 kB
Active(anon):     183936 kB
Inactive(anon):   221040 kB
Active(file):     179940 kB
Inactive(file):   121828 kB
Unevictable:           0 kB
Mlocked:               0 kB
SwapTotal:        452148 kB
SwapFree:         384308 kB
Dirty:               680 kB
Writeback:             0 kB
AnonPages:        354172 kB
Mapped:           119204 kB
Shmem:             48908 kB
Slab:             130348 kB
SReclaimable:     105092 kB
SUnreclaim:        25256 kB
KernelStack:        2320 kB
PageTables:        14848 kB
NFS_Unstable:          0 kB
Bounce:                0 kB
WritebackTmp:          0 kB
CommitLimit:      926856 kB
Committed_AS:    1927420 kB
VmallocTotal:    1114112 kB
VmallocUsed:           0 kB
VmallocChunk:          0 kB
CmaTotal:           8192 kB
CmaFree:              56 kB

Looking at this dataset I’v changed the Dashboard widget to show MemAvailable instead of MemFree :

afbeelding

IMHO this has more information content.

What do you think?


(Ralf Jeckel) #12

I agree. Good idea. :+1:

There are some more non very straight widgets in dashboard:

image
This is also misleading: not 26% are available, 26% are used.

and
image
100% is free and 0% is used.

and
image
same: not 19,5% are available, 19,5% are used.

I know it’s just a flaw, but IMO we should change either “Usage” and “Available” or move the bargraph to the right position.

Should we move this to a new topic @mark_nl ?


(Mark Verlinde) #13

A general conversation regarding the bars in widgets better be donean new topic.
Funny: I never “connected” the label to the bar-graph. (ie) For me “Free swap:” is the label for “376 MB” not for the graph beneath it. :grinning:


(Rob Bosch) #14

I think you are right that the “Available” is connected to the amount of GB/MB/GB on the right side of the widget.
To avoid misinterpretation, the bar graph should not only say “xx%” but better would be “xx% used”.


(Jeroen Visser) #15

… in all cases there should be a little line under the text, as it is the label for the value a bit (far) to the left :wink:


(Ralf Jeckel) #16

As I saw what incredible improvement the dev_team with is doing cockpit-Ui, I think these minor things in standard UI are not the most important on the list.
But your idea of a little line wouldn’t be much work to realize. :+1:


(Jeroen Visser) #17

And I see now that I managed to necro a topic with an answer that was more or less given … good for me :blush: sry guys


(Mark Verlinde) #18

Don’t be sorry, it’s a good thing this got bumped up!

We discussing two things at once (and in general this is confusing)

(A) Do we want to change the memory-widget to show MemAvailable instead of MemFree ?

(B) How can we improve the presentation of the bar-graphs in general ?
continuing here: Improve the presentation of the bar-graphs

Counting the like’s we have 4 votes for showing MemAvailable instead of MemFree

  • Who is against it? (and why)
  • More votes for pushing this trough?