Swap space provides disk storage to which the kernel can move memory pages when available RAM memory becomes exhausted. Swap space is also needed to store the entire contents of RAM when hibernating a system.
Size and location of swap space
There is no perfect size of swap space.
Generally, the size of swap space is recommended to be twice the amount of available RAM.
Ideally, swap space should be allocated on SSDs rather than rotational disks.
It should be taken into consideration to allocate a swap space on each available physical disk. This enables them to be utilized for parallel read and write operations.
It seems that at least with BTRFS, swap space should be placed on a subvolume (see also here).
Forms of swap space
There are two forms of swap space:
swap partitions
swap files (especially interesting for systems with limited disk space)