TransWikia.com

Is Swap File slower than Swap partition in Ubuntu 20.04

Ask Ubuntu Asked by Aadithya Sathya on December 12, 2020

I am programming in python containing numpy array sizes of 200 million for one of my machine learning projects.

During the execution of the program the swap memory is also getting utilized for which I have created enough swap partition (Around 40GB)

I would like to extend my swap partition by creating a swap file. I have a doubt whether the read and write speed of the swap file will be slower than the swap partition ?

Looking forward for some replies on the same

Thanks

Aadithya

One Answer

Once in place, a swap file is used the same way as a swap partition. Through the swap file or swap partition, the kernel knows which sectors are allocated for this use, and uses this space for swapping memory. As such, there fundamentally will be no difference in performance.

A swap file, however, may be fragmented. That would degrade performance on a traditional hard drive, but less so on an SSD.

Correct answer by vanadium on December 12, 2020

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP