Can I utilize multiple swap files in linux on different devices for enhanced throughput?
Yes, you can use multiple swapspaces, but that as such does not contribute to enhanced throughput, only to increased swap space. You can set up multiple swap spaces (partitions or files). These can have the same priority, or they can have a different priority. This is what man swapon
says about how priority influences use:
Swap pages are allocated from areas in priority order, highest priority first. For areas with different priorities, a higher-priority area is exhausted before using a lower-priority area. If two or more areas have the same priority, and it is the highest priority available, pages are allocated on a round-robin basis between them.
The way to enhance throughput is to place swapfiles:
- On the fastest possible medium: this is obvious: the faster the drive, the faster it will read and write swap data. SSD drives obviously are the best choice in this respect, although that comes at the cost of longevity of these drives.
- On a medium different from your system or data hard drive: different drives that work in parallel can deliver speedier data than a single drive that needs to be accessed for different purposes.