Using SSDs in DVRs

Every so often someone asks if I’d use an SSD to store recordings in a DVR. Just a few years ago, I would have quickly replied “No.”  SSD endurance just wasn’t up the demands of recording TV broadcasts.

But the last few years have seen some advances in the durability of SSDs. Now rather than “No”, the answer is “It depends…”

A Question of Endurance

There’s no question that SSDs have a number of advantages over hard drives. They have no moving parts. They’re quiet. They consume less power. And their random access performance is generally orders of magnitude better than their spinning counterparts.

So why haven’t SSDs replaced hard drives in DVRs? One reason of course is cost – as I’m writing this a 1 TB hard drive can be had for under $50, while a 1 TB SSD runs in the neighborhood of $300. That price advantage is continually eroding, however, as there’s a fixed cost to producing a hard drive (and 1 TB drives are close to that lower boundary with one single-sided platter and one read/write head), while flash memory prices continue to trend lower.

But even if SSDs had reached price parity with hard drives, endurance is another factor that had to be – and still must be – carefully weighed.

Hard Drive Endurance

Those of you familiar with the issue of flash memory endurance may want to skip ahead. For the rest of you…If I were to ask you about hard drive endurance you’d probably think about how long it would take for the drive to mechanically fail – the disk will fail to spin up, or perhaps the drive heads have “crashed” into the media leading to degradation of the platters (the dreaded “bad sector” errors). You’d probably think back to how long your hard drive lasted in your PC or laptop. In many cases this can be quite a few years.

You probably weren’t thinking about how much data you wrote to the drive or how frequently a specific part of the drive was rewritten. The hard drive media, like everything in the universe, does have a finite lifespan. However that lifespan is dwarfed by the lifespan of the drive’s mechanical (and sometimes electrical) components.

SSD Write Endurance

Unlike hard drives, flash memory has one major weakness: manufacturers only guarantee you can write to each cell a certain number of times. Keep writing beyond that and you’ll start to see cells fail to retain the bits you tried to write. Those cells are worn out. So unlike hard drives, the “media” itself is likely to fail before anything else.

To give you an idea of how bad this issue can be, in the early 2000s I took a (very) brief look at using flash memory in a DVR we were designing. In those days SSDs hadn’t entered the scene yet. Flash inhabited more primitive devices such as USB flash drives and compact flash cards. We hooked up a well-regarded compact flash card to an IDE adapter and used it in place of the hard drive. We thought it might last a week or so, but things didn’t turn out nearly so well. The card died within an hour.

Now flash controllers in those days weren’t nearly as sophisticated as the ones you find in SSDs today. I highly suspect that wear levelling was very primitive or non-existent, so it was easy to write to the same cell repeatedly and wear it out.

Furthermore we hadn’t optimized any of our workflows or I/O patterns for flash. And as it turned out, the process of loading the software onto the drive and initializing the database was very write-intensive. The amount of writes to the flash cells was much larger than the actual number of bytes we were trying to write – a phenomenon known as write amplification. Basically, you can’t just write one byte of flash memory. If you try to do that, what happens under the covers is that a flash block gets read, the byte in question gets modified, the block is erased, and finally the block is programmed with the updated data. Blocks are multiple kilobytes – at the time 16 KB would not be uncommon. So to update, say 32 bytes you end up writing 16 KB. That’s an amplification of 512! And of course once you got all the software loaded up and started to run the DVR, you had recorded content pounding away at the flash

Fast-forward to 2017

Today we have SSDs with increasingly sophisticated flash controllers. A number of mechanisms such as caching, wear leveling, and adaptive R/W have been developed to prolong the useful life of the drive and better manage write amplification. The folks at StorageSearch.com have a great set of articles on this topic. So it’s worth taking another look at whether SSDs can be used in DVRs.

SSD Lifespan for DVRs

Before we consider whether we can use a modern SSD in a DVR, we need to figure out how long it should last. For the moment let’s set our expectation that an SSD-based DVR should last at least as long as a hard drive-based DVR.

So how long do hard drive-based DVRs last? Browsing the web, one can find anecdotes of TiVos lasting close to a decade with their original hard drives. But even their owners admit that these near-denarians are outliers.

More common lifespans appear to be about five to seven years. I should point out that many DVR users have breathed new life into their DVRs via hard drive transplants. Indeed, in 2016 TiVo had to notify about 3,500 Series 1 users that the Service for that box was sunsetting. That’s 14 years after the Series 2 replaced the Series 1!

DVR Write Workload

To get an idea of which SSDs might fit our five to seven year lifespan, let’s take a look at what we’re going to ask of it.

For the moment, let’s assume we’re only using the SSD for recording the media content.  The operating system, DVR software, and databases will live somewhere else (possibly another SSD). Let’s also be rather optimistic and say that our write amplification is close to 1.0. In other words, there is virtually no amplification.

If one ignores the actual amount of data written, the write pattern for recording shows actually make it a good candidate for SSDs. While recording, media is sequentially written to files, and it’s not unreasonable for DVR software to write media in 512 KB or 1 MB chunks. Provided the underlying filesystem cooperates, these writes would fill entire blocks, so write amplification is minimized. (Aside from the data the DVR is writing itself, the filesystem also updates its structures on the SSD as the DVR writes data. However this amount of data should be small in comparison to the media data written, and is also likely to be handled at least in part by the SSD’s caching mechanisms.)

As for how much data we’re going to write, let’s assume we’re going to record the program as it was broadcast. In many cases multiple virtual channels span a single 19.2 Mbit/s ATSC broadcast, so it’s rare for a single channel to take the full 19.2 Mbit/s. Often there’s a primary HD channel and a few subchannels. Let’s say that the average bitrate for the HD shows we want to record is 12 Mbit/s.

Consumer SSD Lifespan

SSDs come in a few flavors with varying endurances. Enterprise SSDs for example tend to have significantly higher endurances than consumer SSDs. They also tend to cost quite a bit more.

Not having an unlimited budget, we’re going to limit ourselves to a 1 TB consumer-grade SSD, which would be enough to hold about 185 hours of TV. These can be had for about $300 now. Let’s say we pick the following:

     

  • WD Blue 3D NAND 1TB Solid State Drive (WDS100T2B0A)
  • Samsung 850 EVO 1TB 2.5-inch SATA III Internal SSD (MZ-75E1T0/AM)
  • SanDisk 1TB Ultra 3D NAND SATA III SSD – 2.5-inch Solid State Drive – (SDSSDH3-1T00-G25)
  • Toshiba OCZ Trion 150 960 GB 2.5″ 7mm SATA III Internal Solid State Drive (TRN150-25SA3-960G)

Key to understanding how long an SSD will last is its endurance rating, which is usually expressed as Terabytes Written, or TBW. It’s also sometimes expressed as Drive Wipes Per Day (DWPD) for a certain number of years. For these drives:

  • SanDisk Ultra 3D: 400 TBW
  • Samsung 850 EVO: Lower of 5 years or  150 TBW
  • WD Blue: 400 TBW
  • OCZ Trion 150: 240 TBW (0.23 DWPD, 3 years)

First let’s see how long it’s going to take to fill up that  1 TB, or 185 hours, of space. Let’s say we record 12 hours of shows per day. 12 hours may seem like a lot, but most people record a whole bunch of stuff that they don’t end up watching. You may for example record the evening news on a couple channels, but only end up watching them a few times a week. Or you subscribed to a series that you thought you might watch, if only you could find the time. At 12 hours/day, we fill the drive in about 15 days. So in a year we’ll have written the drive about 24 times.

If you’re using the Samsung 850 EVO, then you drive might last about six years. On the other hand, if you’re using the SanDisk or WD Blue, then you should be good for 16 years.

The Toshiba OCZ Trion 150 is in a rather curious position. From a pure TBW standpoint, it should last  9 years or so. On the other hand, it’s only warranted for three years of service. To get to a five year warranty you’d need to get the VX500 rather than Trion 150. With an endurance rating of 592 TBW, the VX500 is listing for $499 on Amazon.

The “Always Recording” Workload

Now let’s redo the math assuming that you have a TiVo-style live cache and a four tuner box. The live cache records 24/7, so with four tuners you’re recording 96 hours/day, or  8x more than the 12 hours/day we were assuming previously.

At 96 hours/day, the Samsung 850 EVO now lasts a bit less than a year, and the SanDisk and WD Blue about 2 years. Most people would find this an unacceptably low lifespan.

And here you see the crux of the problem for DVR manufacturers: even if your DVR doesn’t cache 24/7, it’s hard to tell a customer that if they have a four-tuner DVR, they can’t record four shows 24/7.

But if you don’t need 24/7 recording, SSDs may be a viable alternative to hard drives in DVRs.

Transcoding and Overprovisioning

At the end of the day, the lifespan of an SSD is determined by how frequently cells get written. So it’s reasonable to look at ways that we can reduce this. Two ways are overprovisioning and transcoding.

Overprovisioning

If budget isn’t an issue, then by simply increasing the size of the SSD you’ll end up extending its life, as larger capacity SSDs tend to have higher TBW ratings. For example, while the 1 TB Samsung 850 EVO has an endurance of 150 TBW, the 2TB version has a 300 TBW rating. It pays to look at the specs though: the 4 TB version also has a 300 TBW rating, so just because you got a larger drive doesn’t necessarily mean you end up with a longer lifespan.

Transcoding

Up until now we’ve assumed that we’re recording the as-broadcast MPEG-2 transport stream at an average bitrate of 12 Mbit/s. While that preserves the quality of the broadcast, there are more advanced codecs than MPEG-2 currently available. In addition, broadcasters constrain the MPEG-2 encoding so that you can, for example, tune into a channel and not wait too long for playback to begin. By transcoding to H.264 at 6 Mbit/s and a 2s GOP you’d halve the bitrate but probably not notice any degradation in the video.

Transcoding of course comes at a cost. It’s a rather computationally intensive task that will either consume quite a bit of CPU cycles or required dedicated hardware. And it must be performed for each tuner that’s recording. So if you have a four tuner box, you need to have four transcodes going on in parallel.

Should You Use an SSD In Your DVR?

Depending on how many shows you’re recording (and whether your DVR supports live caching), it may be viable to use an SSD in a DVR.

This still begs the question of whether it makes sense to do so. At present SSDs are quite a bit more expensive and provide lifespans in the same ballpark as a hard-drive would. From a performance standpoint, a hard-drive based system can sustain a six tuner box such as the TiVo Roamio Plus. While an SSD could support a greater number of tuners, one does reach a point of diminished returns.

However looking to the future, SSDs will continue to come down in price while hard drives will not – at least not at the capacities we’re interested in. Provided that endurance can be managed via overprovisioning or other means, in a few years SSDs may well be the storage medium of choice in DVRs due to their price points.