Swap! Beating a dead horse Even More

OK so here goes. I’m buying a new system with an AMD Threadripper 3960x processor and 64 GB of memory. In the past, 64 GB was a lot of memory, but this processor has 24 cores and 48 threads! Simply dividing the memory up by thread, it comes to [only] about 1.3 GB per thread! Now this is an over-simplification as the threads can share memory [sometimes]. One exception is when you assign a few cores(like say 4 cores) to a virtual machine, say running Windows. There are other instances, but this is a classic. In that case, the cores are dedicated to that process. This complicates things considerably.

So I’ve decided to solve this problem with swap. New SSD drives are cheap and huge. So I decided to use swap to solve the problem where a small number of cores might not have enough memory. I’m aware that ssd drives may fail due to a large number of writes using swap so I approached this issue with a 2 pronged approach.

  1. I bought a standard ssd and will dedicate it to swap only to ensure I lose no data on the drive, only the immediate swap if it fails. The main drive is a 5000/5400 PCIE4 NVMe and can’t afford to lose one of those, they’re expensive and I’ve got data on them.

  2. The ssd will be an enterprise-grade Samsung 850 DCT with 3D NAND to ensure lots of reads/writes.

Now I intended to buy a 128 or 256 GB hard drive, which would be a closer match to memory size, but the cheapest one in this class of drive ($100) was 400GB. This caused an even bigger quandary. So the questions I have for your amusement and mine are:

  1. The recommended size for swap is typically 2 times the system memory. Is this per core? Per thread? Because remember I have 24 cores and 48 threads. Some cores will undoubtedly be dedicated to virtual machines. Remember, my memory size at 64GB is only about 1.3 GB per core. Also, ssd swap will be phenomenally faster at 580/500 MB/sec. Does the speed mitigate some of the need to restrict the size of swap in this case?

  2. I have this really big hard drive dedicated to swap. Can I split it into 2 or 4 swap partitions and will it help/hurt with an ssd?

  3. Should I just use a small part of it in a partition, and if it starts to fail, make another partition and use that? Will the extra sectors on the drive already be used up?

  4. With a faster medium like ssd, can I use a larger swap partition than we used to without worrying it will drag the system down?

I’m currently planning 128GB of swap for 64GB of ram, does that sound reasonable? Perhaps will the multiple processors keep the machine from bogging down with swap as machines have done in the past?

Thanks for any comments/considerations.

Please comment

I think this is old advice. I’m on a 64 GiB RAM desktop which I suspend and never hibernate. I have 2 GiB RAM.

I wouldn’t configure zero swap, no matter what advice you see from experts online. That’s a bad idea. Have some, but it depends what you’re gonna do with the system as to whether you really need lots. If you were running a SAP ERP system with a 2TB database and hundreds of users, yeah, tons of swap needed. If it’s a desktop and you’re using standard desktop tasks, a bit of compiling, maybe a bit of video editing, nope, you don’t need that much.

No. 128GB of swap for 64GB does not sound “reasonable”. It sounds “excessive” :smiley:

1 Like