Choosing SWAP file system size in Linux

If server’s RAM is less than or equal to 4GB then the recommended SWAP file system size is 2 GB

If server’s RAM is between 4 GB and 16 GB then the recommended SWAP file system size is 4GB

If server’s RAM is between 16 GB and 64 GB then the recommended SWAP file system size is 8GB

If server’s RAM is between 64 GB and 256 GB then the recommended SWAP file system size is 16GB