Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Introduction

Let's imagine some environment where the speed is not a factor. In my case I am using a really old computer for a "server" with a lot of stupid things ( personal lab ). It is more important the amount of resources, not their speed.

On what hardware we can use it

My "server" is with 4 GB RAM DDR2 800Mhz and Intel Pentium CPU x86_64 ( with two cores ). So the motherboard doesn't support more then 4 GB RAM.

Control of the "swap"

It is a Linux "server", there is a docker install on it, so every application running into a container with RAM and Swap limit.

Also there is a magic variable:

vm.swappiness

The swappiness parameter configures how often your system swaps data out of RAM to the swap space.

Question?

HDD and SSD have life spin. And if we using it for a "swap" it is a high read / write operations. Of course It is not a production "server", but it is not also a desktop / personal computer. Anyway It is a bad situation for everyone to broke the hardware, specially when it is an old and the bigger part of their life is over.

So which one is better? Will be a HDD really slow and useless or SSD has a less life spin then HDD?

share|improve this question
4  
I'd try not to require a swap at all, or disable it, but an SSD will "break" from too many writes, a regular HD shouldn't from just writes, so use the HD? – Xen2050 Feb 14 at 15:49
2  
always choose the SSD. – Keltari Feb 14 at 16:18
6  
Your processor and motherboard will handle more than 4 gb of RAM – Canadian Luke Feb 15 at 0:27
1  
Choose the SSD. Truly ancient SSDs had problems with lots of writes. Any modern SSD should handle heavy writes just. Or at least handle them fine for a decade or more. Most people have replaced their SSD by the. (Granted, most people also do not use DD2 hosts anymore, but I thinkthe point is clear). – Hennes Feb 15 at 9:52
1  
All these answers and yet nobody has asked the critically important questions - what is the load on this server? What are its roles? How many users? With what sort of duty cycle? How much can you afford an SSD? This is a cost-benefit analysis and we know nothing of your needs or your budget. Who can say if it will be "worth it" or not? Is it a music server for two people, and will you starve for a week if you buy an SSD? Or is it a critical service for twenty people who will lose work time every moment they wait for this system? – J... Feb 15 at 12:20
up vote 19 down vote accepted

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).

share|improve this answer
9  
Careful, it's often something like "3 years or X disk operations of guarantee" – Kos Feb 15 at 10:47

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:

  1. Upgrading the machine to allow for more, faster RAM.
  2. Using an SSD as a dedicated swap partition.
  3. Using an SSD as a shared swap and boot/data partition.
  4. Using an HDD as a dedicated swap partition.
  5. 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.

share|improve this answer
    
The worst SSD's are now better than the worst SSD's used to be. The opposite also happened. Some early SSD's were overengineered instead, and they last. Remember, SLC was the initial design, and it's far more robust than MLC and TLC. – MSalters Feb 15 at 11:43

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.

share|improve this answer
    
The advanced version of "I'd not mess with swappyness": do not mess with swappyness without performing a significant number of realistic benchmarks on each setting you consider, to make sure that it actually helps overall rather than making things slower in most workloads and maybe helping a little in a few others. – David Spillett Feb 15 at 10:00

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).

share|improve this answer

The SSD should have internal "wear levelling". Be aware that your CPU usage will increase (fire fed faster) and there may be increased stress on the IO components. In particular older UDMA motherboards were marketed as UDMA100/133 when in fact this was a "burst" speed and not expected to be continuous.

Forget the lifespan, just buy enough for spares, and diarise to swap them out in 5 years, like car batteries.

Hard disks will always suffer from permanent uncorrectable errors, this is a dirty secret not widely mentioned. SSD's are less susceptable in theory but is must still happen or they would not need the Bose-Chaudary error correction. Just bung it in and have spares (you may not be able to buy one when you need one).

share|improve this answer
1  
+1 for the CPU usage. Easy to forget that one, especially on an older system. – Aaron R. Feb 15 at 6:31

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.