Should I use a SSD or HDD for "swap" on an old computer
SSD is definitely a steroid to any system. Even machines already sentenced to scrap are revived by it. On the other hand, factory specifications really state that their statistical lifetime is smaller than that of HDDs. BUT today even the cheapest SSDs are sold with 3 years of guarantee. I doubt anyone can foresee what kind of gadgets we will use 3 years from now, that's pretty fair. Sure, it may still crash within that time frame but, as we all must know, if you have something in one instance only, without a backup, then you have already none, no matter of you have HDD or SSD.
I assume you have already guessed what my thoughts are leading to: unless I had some RAID for which I would have to buy HDDs of the same type, I would buy SSD(s) (well, I did it).
Your question states speed is not a factor, but resources are. In this case, HDDs give you far greater GBs for your money than any SSD on the market currently. If you're after pure resource, HDDs would currently be your best option, depending on exactly how much extra resource you feel you need. However, I'm not sure you really mean that, as in the wrong set up, the speed difference could be very significant.
Now, in terms of reliability, that's difficult to say. Firstly, you haven't actually stated what resource intensive operations you plan to operate that may require a swap partition. The swap partition will only be used beyond 4GB of RAM, so unless you're running operations that are consistently causing >4GB RAM to be rewritten, you may not be causing any PE cycles on SSD blocks at all, and these are our usual indicator of how soon an SSD will fail. An HDD will have mechanical factors to take into account. Even reading across an HDD will cause the heads to seek, possibly quite a lot if you're also using the drive as a normal storage device as well as swap memory. This will cause additional wear to the drive.
Secondly, SSDs are a lot more reliable now than they were at their first implementation (Which unfortunately tarred them as unreliable years later), with most of them easily outlasting the normal life of a machine. Again, it's very hard to say exactly how long a device will live (manufacturers will provide MTTF and MTBF averages, but these are on the whole quite misleading and can only give you a vague statistical idea), but one metric that can give you a somewhat better idea is the warranty periods offered, which typically are longer for SSDs than HDDs now (Figured I should cite a source - Samsung provide 36 months minimum for SSDs and 24 months minimum for HDDs).
Let's consider that speed is a factor. Firstly, your motherboard being of an age where it has DDR2 RAM may only have a SATA2 controller, and as such, you'll probably be bottlenecking the maximum throughput of a lot of SSD's anyway. Of course, the main benefit to an SSD is the incredibly low latency and high IOPS against a HDD, which, if you're using it purely as a swap drive, is going to be very important.
Of course, swap is definitely not a replacement for real RAM, and can't come close to matching the speed RAM, even at DDR2 speeds, can reach. An SSD (heck, even a bank of RAID striped SSDs) looks incredibly slow if you're comparing it to RAM. An HDD looks incredibly slow when compared to an SSD. If you must use a swap in order to make up for a lack of RAM, an SSD will at least give you a fighting chance of making up for the drop in speed.
In order of best case scenario in my opinion:
- Upgrading the machine to allow for more, faster RAM.
- Using an SSD as a dedicated swap partition.
- Using an SSD as a shared swap and boot/data partition.
- Using an HDD as a dedicated swap partition.
- Using an HDD as a shared swap and boot/data partition.
If your situation is 2 or 4, the reliability really shouldn't be a concern anyway, as you won't be losing any actual data and the device should have a long enough warranty to cover you until you can go for the best option of actually having more RAM.
The big question is "Does this support AHCI" - which you'll need for maximum performance and things like trim to work. Even without it, an SSD is faster than a spinning rust drive - but its less of a obvious choice.
You do want an SSD, and having it for swap should make some difference. AHCI support should tip the balance towards getting an SSD tho.
Amusingly enough, while I don't have performance numbers, I've tried a seriously low end ssd with almost no cache, (a 120gb 'king dian' running a silicon motion controller). Its MLC (so slightly longer life) and performance wise its decent - It'll even let you run windows 10 tolerably on a system with less than optimal ram. That said, if you don't have AHCI, your maximum speed is limited (Tried a better drive on a dell mini10, which only runs compatibility mode, and it was underwhelming). Considering SSDs are roughly 30c a gb these days, meh, if its important, back it up, and restore or get a spare. Also consider than an SSD will always have better random access speeds.
I'm almost sick and tired of pointing out SSDs wearing out is uncommon - more likely your controller fails. My answer here covers all that. SSDs rarely wear out. If you're worried, just spend a little more and get a better SSD. Any component can randomly fail.A SSD wearing out the way people fear is desireable since you get ample warning. A SSD or HDD having controller failure or a HDD having a sudden headcrash or something of that sort does not. Treat any storage as something that can fail at any time.
I'd also consider this is an older machine. A modern 'nuc' class machine may have comparable performance (Or better in some respects), save power and probably be easier to maintain. I'd suggest getting an SSD as the first part of a gradual new build. Consider this machine is likely...greater than a decade old and stuff like capacitors may fail. I suspect even a budget SSD may outlast your motherboard. If nothing else, consider seeing if anyone has a machine with DDR3 they want to get rid of cheap ;p. That said, I've upgraded core 2 era laptops and the speed difference has been significant, even on creaky old machines. They were pretty much the earliest systems to support AHCI too.
I'd also suggest not only using the SSD for swap - it makes a ton of sense to get a reasonably sized drive (Its hard to find anything smaller than 120gb anyway) and store your docker containers on it as well.
I'd not mess with swappyness. You want as much ram used as possible, and your system knows when not to page.
The wear levelling algorithms (and individual cells with improved resilience) used by modern SSDs are sufficient that the failure rate even in the face of lots of random writes to a subset of their blocks (i.e. when used as swap in a low RAM situation) will be no worse than a traditional hard drive, so if speed is a factor go for that option.
As you state that "speed is not a factor" though, a non-solid-state drive will give you far more space for the same money, so if you need more space than an SSD in your budget will give then go for that instead.
You could always get both: a small SSD for some parts and a traditional drive for mass storage.
One other difference to note is that in my experience SSDs "just fail" when they go where traditional drives are more likely to fail in a way that will be seen in SMART readings beforehand, so while there is no real difference in overall failure rate a traditional drive may fail in a safer way (i.e. you will get advanced warning) when not used in RAID (assuming of course that you actually monitor SMART readings for changes).
In your HDD vs SSD debate let me give you another alternative: use a USB Flash drive formatted to swap and mount it. Those have a limited lifespan too, but can easily and very cheaply be replaced in case of failure; especially since you will use a relatively low memory flash, such as a 8GB one (2 x RAM-Size should suffice).
This will not be as fast as a SSD disk, since you will be limited to USB bandwidth (assuming your old computer doesn't have USB 3.0), however it still will increase your computers speed noticeably.