Roberto Ragusa
2020-Dec-01 10:53 UTC
[CentOS] Physical position of swap partition on the disk
On 11/30/20 1:55 PM, Jonathan Billings wrote:> On Nov 30, 2020, at 02:35, Nicolas Kovacs <info at microlinux.fr> wrote:>> * /dev/sda1: 500 MB /boot ext2 >> * /dev/sda2: 4 GB swap >> * /dev/sda3: 55 GB / ext4 >> >> I'd be curious to know what's the reason behind this, and if this kind of >> configuration detail is really significant. > > When most of us had storage on rotational storage, the fastest, lowest latency access was close to the physical center of the disc, which corresponds to the start of the disk. You?d want swap to be highly responsive in case it was used for active processes.Well, actually it is the opposite. The first blocks of the disk are on the edge of the disk and they have better throughput since the the track is longer and contains more data to be read in a single disk revolution (rpm is a constant). The idea is that you have swap at the beginning because it needs the best performance, then you have your data immediately after. Having the swap at the end is the worst choice because it is in the slowest zone and it is typically very far from a partially filled data partition at the beginning of the disk, causing a lot of head movement when swapping. The advantage in no-swapping case is minimal, because the swap partition is usually small and having your data starting at 0% of the disk space or at 3% doesn't matter a lot. Finally, swap throughput really matters when hibernating to disk. If you have both your swap and filesystems in an LVM volume, you can shuffle and rearrange them on the disk as you prefer without even a reboot (pvmove with explicit extent indications). Regards. -- Roberto Ragusa mail at robertoragusa.it
John Pierce
2020-Dec-01 11:04 UTC
[CentOS] Physical position of swap partition on the disk
On Tue, Dec 1, 2020, 2:53 AM Roberto Ragusa <mail at robertoragusa.it> wrote:> > Finally, swap throughput really matters when hibernating to disk. > > ....And that's really the only time it should matter on a modern system,. I rarely see /any/ swap in use for normal server or workstation operations