We're moving away from swap partitions on our Linux servers
We have a reasonable number of Linux servers, almost all of them running various versions of Ubuntu. Like pretty much everyone configuring Linux servers, we give them some swap space; the Linux kernel traditionally is much happier if it has a bit of swap space (cf), although you don't want too much. For a long time we used a separate disk partition for this (or a mirrored pair of them in a separate software RAID mirror device), although Linux distributions themselves were increasingly moving to using swap files located in the root filesystem (sometimes rather excessively large ones; the Ubuntu 20.04 and 22.04 installers use 4 GB even for machines with only 4 GB of RAM). We didn't have any particularly strong reasons for using a swap partition instead of a swap file; it was just what we'd started out with and what we were used to.
Source: We're moving away from swap partitions on our Linux servers, an article by Chris Siebenmann.