Understanding memory usage

Status
Not open for further replies.

Alik

Dabbler
Joined
May 26, 2015
Messages
14
Hi
I am having difficulty understanding the memory usage. I have 10gb in the machine and have attached the screenshot of usage and not sure if its right as it looks like all of it is being used.

If someone can clarify if this looks right would be appreciated. Just running freenas no vm's at this point.
 

Attachments

  • mem.PNG
    mem.PNG
    147 KB · Views: 1,681

garm

Wizard
Joined
Aug 19, 2017
Messages
1,556
ZFS will fill most available RAM with ARC, unused RAM is waste
 

Chris Moore

Hall of Famer
Joined
May 2, 2015
Messages
10,080
Hi
I am having difficulty understanding the memory usage. I have 10gb in the machine and have attached the screenshot of usage and not sure if its right as it looks like all of it is being used.

If someone can clarify if this looks right would be appreciated. Just running freenas no vm's at this point.
The fact that you have some swap being used indicates that you need more RAM, especially if you want to be able to run VMs.
ARC, by default, will use all but 2GB of RAM which is reserved for the OS.

Here is some documentation that may help you understand the principles better.

Slideshow explaining VDev, zpool, ZIL and L2ARC
https://forums.freenas.org/index.ph...ning-vdev-zpool-zil-and-l2arc-for-noobs.7775/

Terminology and Abbreviations Primer
https://forums.freenas.org/index.php?threads/terminology-and-abbreviations-primer.28174/
 

MrToddsFriends

Documentation Browser
Joined
Jan 12, 2015
Messages
1,338
A certain amount of swap usage while having free RAM is unfortunately not unusual with FreeNAS 9.10 and later versions, even in use cases where 32GB RAM should be ample. See also

https://forums.freenas.org/index.php?threads/swap-with-9-10.42749/
https://forums.freenas.org/index.ph...ny-used-swap-to-prevent-kernel-crashes.46206/

You can try to use Stux' pagein script (to free swap space periodically) or to use some tunables as discussed in the "Swap with 9.10" thread (to avoid objectionable swap usage).
 

Alik

Dabbler
Joined
May 26, 2015
Messages
14
Thanks for the answers I guess i'll have to figure out how to remove/reduce swapfile size. Am a windows user so doing that was easy, guess removing/delete swap file on freenas might be more involved.
 

danb35

Hall of Famer
Joined
Aug 16, 2011
Messages
15,504

Redcoat

MVP
Joined
Feb 18, 2014
Messages
2,925
The swap is set on the System Advanced tab - the default value is 2GB per disk and is mirrored, so a one or two HDD system will have a swap size of 2GB (as do you). If you decide to change that value, only disks installed after your change will adopt the new swap size, the current ones will not.

Why do you want to change the swap size? I think that what you have is "normal" behavior and I believe that @danb35 is indicating the same in his post above.

Your 10GB RAM might be limiting anyway depending on your intended usage, given the minimum requirement of 8, recommended 16, for current and recent FreeNAS versions.
 

MrToddsFriends

Documentation Browser
Joined
Jan 12, 2015
Messages
1,338
Thanks for the answers I guess i'll have to figure out how to remove/reduce swapfile size. Am a windows user so doing that was easy, guess removing/delete swap file on freenas might be more involved.

There is no need to remove existing swap partitions. Just use Stux' pagein script (the most easy variant to deal with this situation) or start to experiment with a few tunables as already indicated above.
 

danb35

Hall of Famer
Joined
Aug 16, 2011
Messages
15,504
There is no need to remove existing swap partitions. Just use Stux' pagein script (the most easy variant to deal with this situation) or start to experiment with a few tunables as already indicated above.
...or not, since there's no indication here that either of those is at all necessary. There's nothing wrong with the system using some swap, other than that people here whose knowledge hasn't been refreshed in the last three years will say "your system should never use swap."
 

MrToddsFriends

Documentation Browser
Joined
Jan 12, 2015
Messages
1,338
...or not, since there's no indication here that either of those is at all necessary. There's nothing wrong with the system using some swap, other than that people here whose knowledge hasn't been refreshed in the last three years will say "your system should never use swap."

Of course there's nothing wrong with using some swap generally. I did see situations in the past where this swap usage led to severe sluggishness of the GUI, though. Beyond that, swap usage led to unnecessary system instability before the implementation of swap mirrors in FreeNAS.
 
Last edited:

Chris Moore

Hall of Famer
Joined
May 2, 2015
Messages
10,080
My 128 GB home system would disagree with you:
View attachment 23446
My 32GB system would tend to disagree with you.

upload_2018-3-17_10-17-32.png

upload_2018-3-17_10-19-24.png

I realize that it has only been online for a week, but it will run like that for months.
If you are using swap, it is because of something your doing, or you don't have enough RAM.
 

Chris Moore

Hall of Famer
Joined
May 2, 2015
Messages
10,080
Thanks for the answers I guess i'll have to figure out how to remove/reduce swapfile size. Am a windows user so doing that was easy, guess removing/delete swap file on freenas might be more involved.
Don't try to apply Windows knowledge to FreeNAS. There is absolutely no comparison.
Here are some resources that you should review to learn more about FreeNAS.

Slideshow explaining VDev, zpool, ZIL and L2ARC
https://forums.freenas.org/index.ph...ning-vdev-zpool-zil-and-l2arc-for-noobs.7775/

Terminology and Abbreviations Primer
https://forums.freenas.org/index.php?threads/terminology-and-abbreviations-primer.28174/

There are more in the button in my signature.
 

danb35

Hall of Famer
Joined
Aug 16, 2011
Messages
15,504
If you are using swap, it is because of something your doing, or you don't have enough RAM.
I think we can rule out that I don't have enough RAM. I'm not running VMs, I do have a few jails, and I don't appear to have any relevant tunables set:
upload_2018-3-17_12-18-23.png

So I wonder what I'm doing wrong to cause the swap. Or maybe I'm right, and using some swap doesn't indicate a problem the way it once did.
 

Chris Moore

Hall of Famer
Joined
May 2, 2015
Messages
10,080
using some swap doesn't indicate a problem the way it once did.
Using swap probably is not the problem it once was, but with the amount of RAM you have, you shouldn't need to use any, unless it is because of the jails. I don't know what else you are doing with the system that may be using memory and I am not saying you are doing something "wrong".
I just know that I have a server at work that does absolutely nothing but share around 250TB by Samba and with 128GB of RAM it only uses about 80% of that for ARC and doesn't use any swap. When I setup the system, I put the swap on SSD so it would be fast if it needed to be used, but the system isn't using it. I had planned to upgrade RAM to 256GB if I saw a lot of swap usage and I have not submitted the order.
As to the OP in this thread, I don't know how much storage he has. I didn't see it if he said, but with 10GB of RAM, I would say it is a good idea to bring it up to 16GB and see if that keeps the system from using swap. Even if he doesn't do that, using a little swap is not such a big issue.
 

danb35

Hall of Famer
Joined
Aug 16, 2011
Messages
15,504
with 10GB of RAM, I would say it is a good idea to bring it up to 16GB and see if that keeps the system from using swap.
Agreed there--more RAM is pretty much always a good thing.
 

diskdiddler

Wizard
Joined
Jul 9, 2014
Messages
2,377
I ran 8GB with a 30TB array fine for 2 years. The graph is useless, it uses all the ram it gets basically.
 

Jailer

Not strong, but bad
Joined
Sep 12, 2014
Messages
4,977

Chris Moore

Hall of Famer
Joined
May 2, 2015
Messages
10,080
And my 32GB system would disagree with you.
How many other things are you doing with the system besides just file sharing?
I stipulated to that before. If you are doing enough things with the system it will eventually have no choice but to hit the swap.
 

MrToddsFriends

Documentation Browser
Joined
Jan 12, 2015
Messages
1,338
How many other things are you doing with the system besides just file sharing?

While you didn't ask me personally I think it's appropriate that I'm writing a few lines.

Most of the time I'm doing literally nothing beyond lightweight file sharing, backups of three Windows PCs and usual periodic maintenance jobs on my FreeNAS system with 32 GByte RAM. I think that it's safe to assume that this amount of RAM is ample for my use case. Since upgrading to FreeNAS 9.10 (now running 11.1-U2) the system started to use some swap (up to a few hundred MBytes, sometimes less) on most but not all occasions when a scrub of data pools was triggered. Besides that I saw some other occasional swap usage occurrences I could not relate to a possible cause.

I'm not the only user that sees this effect and the only way to prevent this swap usage seems to be to set some tunables as discussed in the "Swap with 9.10" thread, to which I pointed to several times so far.
https://forums.freenas.org/index.php?threads/swap-with-9-10.42749/

The only somewhat unusual configuration detail of my system that might be partly responsible for this behavior is the existence of three data pools (consisting of a single mirror vdev each). My scrubs are scheduled in a way that scrubs of all three pools are started simultaneously.

Thanks for your attention.
 
Last edited:

Alik

Dabbler
Joined
May 26, 2015
Messages
14
I am also just doing basic file sharing for now. And a backup every now and then. Surely the swap file exists to make things faster which means even if it is there it would help rather than hinder the performance?
 
Status
Not open for further replies.
Top