7

I have a PostgreSQL server which occasionally hangs for a long time on writes to my hard disks. Sometimes the fsync system calls take more than two minutes to complete.

Now I am wondering if moving the database from an mdadm RAID-1 on two hard disks to an mdadm RAID-1 on two SSDs will improve performance.

I know that for random access reads an SSD will easily outperform a hard disk. But that is not very important to me as I have enough memory to cache the entire database multiple times over.

I also know that write performance on an SSD is not nearly as good as the read performance. But I don't know how it compares to write performance on a hard disk.

If I move the database to SSD, can I expect improved write performance? If this depends on which SSD I choose, which specs on the SSD are important for me to consider?

  • I've closed this question because it's more of a general advice-type question, which are no longer in scope. – Undo Nov 2 '15 at 17:34
5

It depends mainly on the type of NAND the SSD uses, and also somewhat on the controller.

Higher quality SLC NAND stores one bit per cell. This make the cells much faster and longer lived, whereas MLC and TLC (2 bits and 3 bits) degrade more easily and are harder to read and write, especially write. Since the MLC SSDs are more common, most SSDs do have slow writes (compared to their reads)

If you just run out and get the cheapest SSD, you're likely to find yourself something faster than a HDD by only the slightest margins in read speed, like the Kingston SSDVNow. In some circumstances, this SSD will be slower than a HDD.

Larger SSDs are also faster, because they're composed of multiple chips effectively in RAID 0 (it's similar).

OCZ Vertex, Sandisk Extreme and Samsung Pro are all models to look for if you want the fastest performance.

Alternatively, if you're on a budget (who isn't), the Samsung EVO, OCZ ARC (they've renamed their mid range a few times, but I'm pretty sure this is the newest), and the Crucial MX range are easier on the wallet.

Be sure to find some benchmarks before you buy, and remember that the newest isn't always the best. The older SSDs on larger processes are often longer lived, if you're making lots of writes. Also check out the newer SSDs with 3D V-NAND if you're concerned.

| improve this answer | |
  • Comparing the internal workings of the ssd to a raid is a wonderful idea. – peterh - Reinstate Monica Sep 18 '15 at 21:14
  • 1
    Watch out with the SSD lifespan (in how much write it can handle). If your database writes a lot you must plan to replace your SSD before that is limit is passed. If the SSD is damaged due of too much writes the data is still readable in the damaged sector at the last state before the error. Some SSD have a security zone in order to correct this event but don't push too much your luck : if it occurs change it ! (you must monitor it) – Antoine Rodriguez Sep 19 '15 at 19:31
  • @AntoineRodriguez, You're right about that, but with the SLC SSDs (especially at larger process nodes), that's not much of a worry, as they can stand about 8000 write operations per cell. That's 2 PB written before a 250 GB SSD fails. That said, failures can be unpredictable, so if OP does see some reallocated sectors, he should add another drive to the array. – timuzhti Sep 19 '15 at 23:57
  • 1
    I bought a Kingston SSDNow hard drive to replace my old platter drive years ago as my first ever SSD, and it was dramatically faster. I don't know what you're talking about with its being slower than a HDD. Virtually any solid state drive will blow most HDDs out of the water in terms of random read/write performance. – Jez Oct 8 '15 at 11:06
  • @Jez, it depends if you got the ones with synchronous NAND, which they switched out later. The difference is mainly in sequential write though. – timuzhti Oct 8 '15 at 12:08
2

The answer is simple: yes, switching from HDDs to SSDs is a huge improvement but that depends on the write and read speed of the SSDs themselves.

Personally I gave up a 1TB HDD for a 240GBs SSD and it was the best choice ever. (programming, OS and gaming refference)

The SSD's write and read speeds are different from one SSD to another. Personally I have one with the same write&read speed, about 540MBs/s.

It depends on the manufacturer and also the product itself.

| improve this answer | |

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