ZFS SWAP partition or swap file?

Greetings all,

I am planning new server installation. The operating system will reside on SSDs (mirrored) and the data on mechanical hard drives. I am wondering whether to use SWAP partition or swap file.

As best as I understand, a SWAP partition needs to be mirrored and only the allocated partition space can be used. This appears to be inefficient use of space; furthermore, the SSD limited write capacity may pose a problem.

On the other hand, the swap file may compete for the space resources up to its defined size anywhere on the pool, which appears to be using the space efficiently and mitigates the limited write capacity.

Although the above analysis would point to the latter, I have found the following article: http://www.schmidp.com/2014/01/05/freebsd-10-does-swap-work-on-a-zvol/, arguing that using swap space either on ZFS filesystem or in a ZVOL has a potential to render the system non-responsive.

Since I am by no means an expert, I thought that I would ask:

1. Is my understanding correct?
2. Is my concern regarding limited write capacity of the SSD reasonable?
3. What would be the best practice for a stable system?

Kindest regards,

M
 
So the part of that that is odd is that zfs will give back memory if the system needs it. Also, if a modern system starts swapping it would be very odd. Swapping was invented for low memory situations. The freebsdFreeBSD kernel will run at like 1GB on a big system with lots of workload. So if you are running with MB's of ram you might be in trouble. You are not going to swap out zfs cached pages, zfs will just release them. ZFS mostly uses memory for read cache and is consistently evicting.

Maybe someone who knows more about what might be swapping/paging on a freebsdFreeBSD system will have more insight, but I always say if your swapping your in bigger trouble than zfs can fix :) If there is no real memory left on a modern system(most systems have minimum 4GB) yes you are in trouble.

All of the oracle zfs and opensolaris based zfs systems run swap on a zvol and typically in with the boot drive.

All that being said, I would like to keep my swap zvol on my boot volume and not put out into the pool. I like to be able to move pools from system to system and like to keep things that are system specific in the boot/root pool...
 
Back
Top