Loading build...
Loading...
Your Shops
Why Your SSD is Slowing Down and How Windows Write Caching Could Save the Day
By xquatrox on September 8th, 2018 at 04:17pm - original article from game-debate

Recently I felt that my PC was not performing to its fullest. Steam started taking a long time to allocate storage for game installs, the system itself didn't feel as snappy as it once did. I decided it was time to check how the SSD performs.

For the longest time, I considered that I knew enough about how SSDs work to get me by - and that certainly was the case for a few years. I am sure you fine folks are in the same boat. Even after all these years though, a curveball can hit you when you least expect it.

And, sure enough after testing the SSD, this is the speed I was greeted with on my shiny Samsung 950 Pro 512GB NVMe M.2 SSD:

Samsung 950 Pro 512GB NVMe M.2 SSD CrystalDiskMark

And, for point of comparison, here is out this exact same drive should be performing.

In the top drop-down boxes, the 5 and 6 refer to the number of runs through the test. The more runs performed, the more accurate the results are. Three is usually plenty. The second number is the size of the file. The smaller this size, the faster the test will complete, although smaller file sizes can lead to false results. 1GB should generally be enough though, as in the example below. 

Samsung 950 Pro 512GB NVMe M.2 SSD CrystalDiskMark Example

A similar case was happening with my other SSDs, with write speeds varying between 35MB/s and 120MB/s, depending on the drive in question. It's widely known that the more full an SSD is, the slower its performance becomes, but the difference in performance here is clearly more significant than some minor slow-down.

So what gives? Were they dying? I tried updating my SATA and NVMe drivers; updating the chipset drivers; made sure TRIM is enabled; made sure the drives are optimized; made sure nothing was hogging the resources; checked the health of my drives using Samsung's own software, etc. I couldn't figure it out!

This is where I did what every one of us would do and I delved into the online depths (both GD and our old pal Google) to see if I could figure this one out somehow.  

I ended up re-reading an SSD optimization guide online - everything was, seemingly, fine and dandy my end. But I decided to turn off a setting called "Enable write caching on the device" as I thought maybe that's what's causing a problem.

Nothing changed.

For some reason, after a bunch of googling, I decided to enable it again - It couldn't hurt, I thought. After a benchmark - my SSD speeds were back to normal!

SSD Change Settings Policy Tab

ssd-950-pro-512gb

Excited and nearly filling my pants with joy I disabled and re-enabled the cache on all drives and now I'm all good again!

Interestingly, this was the case as well when booting from an external drive running Windows 10 LTSB (Long Term Servicing Branch), which I tested to make sure a different set of drivers and software is used and that the drive is not affected by the host system's potential corruption. I got the same results - painfully slow write speeds with the cache disabled and normal "magazine shot" speeds with it enabled. But what gives?! What is this "write cache"?!

To illustrate further, here's a comparison on a Samsung 960 EVO 1TB drive. These drives are known to be MUCH better than the 950s, but they still exhibit a big drop if the cache is off:

Write Cache OFF

Write Cache OFF

Write Cache ON

Write Cache ON

 

This is where I got a lot of confusing information!

Many websites and forum posts and even GD's own Tzzsmk said write cache uses system RAM to write the data so that write calls can be dealt with quickly, leaving the slow drive to write in the background. It sounds logical on paper. But it's not really. Because if this was the case - we'd be seeing read/write speeds of 10GB/s and upward - in line with system RAM transfer speed - which is precisely the case if you enable RAM caching (RAPID) via software like Samsung Magician. What you see instead is just the normal advertised speed. So how does that work?

Apparently, the "Enable write caching on the device" setting looks at each drive and determines whether it has its own write buffer (cache). If so, it uses that and gives you an option for it. (Here's a link to Microsoft's own documentation). Now, this makes much more sense - this is why we don't see the RAM speed when writing into the disk - we see the speed of the cache/buffer.  

This was supported by a review on PC World I found where the author was getting the same sluggish 35MB/s write speed before installing NVMe drivers for the same SSD as mine, proving the driver is necessary for Windows to see the cache and use it.  

Now the confusion, I assume, stems from the fact that SSDs also use DRAM memory as a fast cache - it is easy for anyone to confuse this with DRAM used as *system* memory (RAM), thus the plethora of confusing information online.

But why is this interesting and important?  

1) SSDs generally appear to use much slower NAND for actual long-term storage. I've seen write speeds of 35-70MB/s, sometimes more, depending on the drive - nothing close to what's on the box.

2) Read speeds are, arguably, the important ones. These are generally unaffected by the caching setting, but benchmarks do show an improvement there too.

3) It's generally believed that SSDs use caching on their own, internally, regardless of the OS settings. This is wrong, as shown by testing and the information available.

4) Large, sustained writes will slow down dramatically once the cache is full. How large the cache is, depends on the manufacturer and the particular SSD model. But, once it runs out, and it will at some point (especially on cheaper drives) - your file copy will slow until the file copy is finished. See the image below for a scenario I created myself to illustrate the issue. The speed drops once the total data written hits about 8GB.

SSD Copy Speed NAND

5) The cache may be using volatile DRAM (similar to your system RAM) and, therefore, you might lose data if the power to the device gets cut off before the cache is dumped onto the long-term NAND storage. In other words, the system will tell you that your file copy is done, but there's a short time period during which the cache is being emptied onto the storage cells. If your PC suffers a power cut or you unplug the SSD (say, you may be using an external one) - data loss may occur. Windows even warns you about this right there in the setting.

So, there you have it, folks! The curious case of SSD tech - how it can fail either on Windows, via user fault or a driver error - and how it all really works.