sysctl.swappiness

Status
Not open for further replies.

iposner

Explorer
Joined
Jul 16, 2011
Messages
55
So I've had my nice RAID-Z array running for a year or so now. Very happy. Problem is, that when I set it up, I set it up with the recommended 2GB swap space per disk.

Now when I try and run either of the media servers, I get errors indicating insufficient swap space. I realise that resizing the swap space would mean destroying the array, so I was nosing around the net and found that there was this tunable sysctl vm.swappiness value for Ubuntu that controlled the preference for swapping memory to disk.

Is there the equivalent for Freenas/BSD? Could this be used to relieve my problem? Could I reduce the swappiness of my freenas setup and therefore reduce the amount of data being pushed to my swap partitions?
 

cyberjock

Inactive Account
Joined
Mar 25, 2012
Messages
19,526
If you are using swap space you need more system RAM. Generally speaking, your server shouldn't be swapping unless you are expecting too much from your current quantity of RAM.
 

iposner

Explorer
Joined
Jul 16, 2011
Messages
55
I'm not doing anything with it. At the time I'm scanning the files, there's no other activity. So I would expect any zfs caching to be dropped so that the media server has additional RAM. That's the behaviour I would like, anyway.
 

cyberjock

Inactive Account
Joined
Mar 25, 2012
Messages
19,526
ZFS expands to fill its cache size. It doesn't really every shrink the cache. The only time it discards data is to make room for new data.

And no, you don't want that behavior. What you don't want is ZFS discarding data that it actually needs, which could make performance so poor you wouldn't be able to stream a movie anyway. If you want ZFS to not use all of the RAM it does, you will have to tune it(or if you tuned it improperly you could be causing the low swap space condition). By default, ZFS won't allocate more than 7/8ths of physical RAM, so the fact that you are using so much swap space means some other program is needing lots of RAM.
 
Status
Not open for further replies.
Top