Swap becoming full with unused RAM

f4242

Explorer
Joined
Mar 16, 2017
Messages
97
Hello,

I have a problem with one of my truenas box. Swap usage is increasing and after a few days I have to reboot because my swap become full. While my swap is increasing and become full, my RAM usage is still only at about 50% (16/32GB free) according to htop. Any idea what's wrong?

Thanks.
 

hescominsoon

Patron
Joined
Jul 27, 2016
Messages
456
with your storage setup I would be running no less than 64 gigs of ram. If you look at my r520 i am actually running 128 gigs of ram. The more ram the better..and it's cheap.
 

f4242

Explorer
Joined
Mar 16, 2017
Messages
97
I have 16GB of RAM doing nothing and the only solution is add more RAM??
 

SweetAndLow

Sweet'NASty
Joined
Nov 6, 2013
Messages
6,421
Hello,

I have a problem with one of my truenas box. Swap usage is increasing and after a few days I have to reboot because my swap become full. While my swap is increasing and become full, my RAM usage is still only at about 50% (16/32GB free) according to htop. Any idea what's wrong?

Thanks.
Hardware specs need to be included in your post for the system you have issues with. Also the version of truenas and anything you have changed that might be interesting.
My guess is you have set some tunables that broke your system. If your ever have more that zero swap usage something is wrong.
 

f4242

Explorer
Joined
Mar 16, 2017
Messages
97
Hello,

You can see my NAS specs in my signature.

Thanks
 

hescominsoon

Patron
Joined
Jul 27, 2016
Messages
456
are either of you running jails or vm's?
 

f4242

Explorer
Joined
Mar 16, 2017
Messages
97
With 32GB, swap definitely shouldn't be an issue unless you are running a number of jails/plugins/VMs.

Are you running any of the above?

Hello,

I have a VM (with 8GB allocated RAM) and a little jail (burp server). No plugins.
 

jgreco

Resident Grinch
Joined
May 29, 2011
Messages
18,680
Hello,

You can see my NAS specs in my signature.

Thanks

Moderator note:

We prefer that you post your "NAS specs" in the message itself.

Signatures are generated on the fly, so when someone is looking at your signature in the year 2025 and it shows a 96 core system with two terabytes of RAM and 60TB HDD's, because that's what you've got in 2025, readers may be a bit confused. Placing your details in the message body itself helps keep the facts of your system at the time of posting available for future readers to review.

In the future, please try to remember that community members are here on their own time, so whatever you can do to communicate your problem in an easy-to-digest manner is likely to get you better responses from everyone.
 

HoneyBadger

actually does care
Administrator
Moderator
iXsystems
Joined
Feb 6, 2014
Messages
5,112
Hello,

I have a VM (with 8GB allocated RAM) and a little jail (burp server). No plugins.

I would look at cutting your maximum ARC size down by a minimum of 10GB - not sure how hungry burp server is (likely depending on workload) but that's my first guess, there's competition between ARC and your VM/other workloads.

If you run top -w then type o and write swap for sort order, what's at the top of the list?
 

f4242

Explorer
Joined
Mar 16, 2017
Messages
97
I would look at cutting your maximum ARC size down by a minimum of 10GB - not sure how hungry burp server is (likely depending on workload) but that's my first guess, there's competition between ARC and your VM/other workloads.

If you run top -w then type o and write swap for sort order, what's at the top of the list?

Hello,

My swap is currently to zero because of a reboot yesterday. I'll check that next time.

Thank you!

My NAS specs is...
TrueNAS 12.0-U2
ZFS Pool: RAIDz2 with 8 drives

CPU: Intel Xeon E3-1220 V5 3.0GHz Quad-Core
Motherboard: Supermicro MBD-X11SSH-LN4F Micro ATX LGA1151
Memory: 2X16GB Kingston ValueRAM KVR21E15D8/16 16GB DDR4-2133 ECC
Boot drive: Intel 600p Series 128GB M.2-2280
Storage drives: 4X HGST NAS 4TB 0F22408 64MB 7200RPM + 4X HGST NAS 4TB 0F26902 128MB 7200RPM
Case: Silverstone Technology CS380B with Hot Swap Cases
Power supply: Corsair RMx 550W 80+ Gold Certified Fully-Modular ATX
 

f4242

Explorer
Joined
Mar 16, 2017
Messages
97
Hello,

So today I'm using 16.1GB of RAM on 32GB. Swap usage is 3.37GB on 4GB (according to htop). Here is a screenshot of my top output. Process at the top of the list move a lot, I don't think swap is allocated to one specific process.

truenas2021-03-23_17-37.png
<

Thanks!
 

hescominsoon

Patron
Joined
Jul 27, 2016
Messages
456
With the amount of storage you have in that box..i am sticking iwth you need a ton more ram. You siomply do not have enough. YOu can screw with system settings if you want...There's a reason i run 128 gigs in my r520. I have one vm going in it..1 iscsi connection, 32smb connections and another ssh connection between this server and it's backup target over 10GB. Throw in at least 96 gigs of ram..and i bet your issues are over...ZFS loves ram...there's a reason the "rule of thumb" exists. Folks have gotten away with not following that....I always have..and never have had any swap usage...at all...and so I've never had to worry aobut reducing arc or anything else. give it enough ram to do what it wants to do how it wants to do it.
 

sretalla

Powered by Neutrality
Moderator
Joined
Jan 1, 2016
Messages
9,703

f4242

Explorer
Joined
Mar 16, 2017
Messages
97
You didn't do what @HoneyBadger asked:
top -w then o then swap

This will put the items consuming swap at the top of the list.

Hello,

Yes this is what I did so something wrong happened as I see that the swap colum is indeed all zero on my screenshot. Sorry for that. Here another one.


truenas2021-03-24_08-43.png
 

sretalla

Powered by Neutrality
Moderator
Joined
Jan 1, 2016
Messages
9,703
Sorry for that. Here another one.
No problem, it's a very different picture...

if you do it again with o and size instead of swap, you should see what's taking up all the memory... maybe it's VMs or jails?
 

f4242

Explorer
Joined
Mar 16, 2017
Messages
97
Yes the first process is my VM at about 8.2 gb (8 gb allocated in VM settings). Inside the VM, I currently use only 300 mb of RAM. Next are two middlewared processes, snmp-agent.py then winbindd and smb processes.

If I add top 15 process that sum to about 11 gb of used RAM. Top command say the ARC size is 5.7 gb for a total of 16.7 gb. This relates to the RAM+swap current usage. The remaining question is why the OS swap instead of using free RAM?

Thanks!

truenas2021-03-24_09-10.png
 

hescominsoon

Patron
Joined
Jul 27, 2016
Messages
456
Because if you read about ZFS it really wants 8 gigs for itself minimum. The information is right here on this site. Plus you have SMB going along with other things that are just basic operations for your environment. You can try to make all of that operational process fit into too small of a container or in your case the absolute minimum would be IME(aka how i do things) 64 gigs of ram. Ram isn't that expensive on the used market and will save you something more important...time and frustration.
 

jgreco

Resident Grinch
Joined
May 29, 2011
Messages
18,680
Because if you read about ZFS it really wants 8 gigs for itself minimum. The information is right here on this site.

Actually, it's a combination of the middleware and ZFS. The middleware is a bit fat but can get swapped out. ZFS will use all the RAM it can, but can be squeezed. This system is showing some memory stress but it isn't clear to me what's using the swap.
 
Top