SSD; HDD; IO; Cache
A couple of days ago I bought a 60GB SSD disk for my primary computer (home desktop). It made a world of difference. I thought I’d share some info on how disks works and what the differences are. The aim is to keep this post at a level where people with a medium understanding of computers and hardware can keep up.
My current system
My computer is a custom built quad ~3GHz, 8GB thing with a Asus Republic of Gamers Maximus Formula motherboard. Fast and shiny a few years back, still kicks ass. I have two graphics cards: ATI 5700 something (800 stream processors, 1 or 1,5GB RAM?) and an older NVidia 9600GTO (96 stream processors, 768 MB RAM). Most games run at top resolution without any problem. 4 harddisks with a total of 4TB space. Two 1,5TB disks are in mirror, these were also my system disks.
I’m a poweruser. By that I mean I install a lot of programs and SDK’s. I even use Interix. So I have 1,496,388 files on my computer – much of which is Cygwin/Interix/ SDK’s/backup of old installations, etc.
I must admit I’m fairly interested in hardware. I know much about how stuff works in the really low levels like signaling, frequencies, CPU and motherboard architecture, communication between components, operating system drivers, etc. I’m a developer that consider L1/L2 caching when writing code and see the code in number of instructions rather than functionality.
I figured that with 8GB of RAM I keep most of the important stuff in cached in memory, so the difference with SSD after the initial boot would not be that great. I have been planning to upgrade to 12GB or 16GB, and I’m looking into buying a whole new system. But that is usually a big investment of around 12000 NOK (just over $2000) for just the computer (chassis, power, MB, CPU, RAM, HD, graphics).
Some thoughts on HDD
Old-school harddisk has some problems.
- If you compare the HDD with everything else in your computer then the size of the disk has increased over the past 20 years, but compared to other components the speed has been standing almost still.
- The evolution of PATA, SATA, SATA2 and SATA3 allows the computer to communicate faster with the disks. But the disks are not actually that much faster, they use ‘cheats’ to make them appear faster.
- Write cache and read-ahead is one such cheat that help speed up things. Write cache allows Windows to make a relatively small write to the harddisk without waiting for the data to be physically stored. Read-ahead is a feature where the harddisk reads more data than was requested because it was there anyway so the extra read-time required for that is so small compared to the statistical probability that the file is in sequence (not fragmented) and that the app will request more data from it. Remember that the harddisk has no idea of what a filesystem is, so it will not skip read-ahead for small files or understand fragmentation.
- Windows also has write caching which uses RAM to queue disk writes. The main purpose of this is to avoid many small writes, say for example if two or more applications are writing at the same time. By waiting a little bit many small write operations can be combined into fewer big write operations.
- Windows supports extended write-behind caching so that it can help the harddisk write out data in sequence using the elevator algorithm to avoid moving the disk head too much, but this is dangerous as it both breaks NTFS journaling and can result in a massive loss of data if power is cut or Windows crashes.
- Servers usually have onboard RAM on the RAID-controller with battery backup in case of power loss. This allows it to continue writing the data when power comes back.
So I bought a 60GB SSD disk. My expectations were:
- This should speed up things. From around 30MB/s actual speed to somewhere over 285MB/s read and 275MB/s sustained write (at least that’s what the spec said).
- Seek time is gone. This is the time it takes harddisk heads to move around the harddisk.
- My old drives will be worn out, and even if not used it will be demagnetize and loose data in a few years. My SSD will “last forever” (or at least 20 years+).
- SSD’s do get worn out by write-operations, but that is handled automatically so there is no loss of data.
What I discovered after installing it (subjective observation):
- Installing Windows 7 Ultimate from USB pen to SSD disc took 8 minutes. Really! 8 minutes until the desktop was ready for use.
- Windows boots in around 20 seconds. When the desktop comes up it is immediately ready for use. No slow loading of apps in the background.
- Suddenly my BIOS feels slow. Before I didn’t notice it because Windows was so slow to boot.
- Quiet! Going from 2 disks in mirror hammering around to a quiet SSD-disk was just surreal.
- Applications start immediately. Even heavy stuff like Outlook with addons and ~5GB PST-file takes just a couple of seconds.
- Chrome and IE starts immediately. Web pages with Flash load much faster.
- Start menu searching (even with sh*tloads of mails and files indexed) is done faster than I can type each letter.
- Windows now feels like this was what Microsoft intended Windows to feel like. Very responsive!
- My old drives could take about 65G of shock, the SSD can take 1500G. Perfect for laptops!
- Data transfer speed is increased by around 10x.
- Seek time is gone. In a HDD the heads needs to keep moving back and forth to do read/write operations. This is a damn slow process. Access to any file requires the heads to be moved to a certain location.
- Disk fragmentation is (almost?) history. I haven’t looked into the details yet, but since NTFS default cluster size is 4k, Windows has 4k page size (memory blocks) the SSD disk works on 4k blocks it’s a pretty good match. I’m guessing there is some penalty of fragmentation, but it is nowhere near that of a HDD.
- Even though I have enough memory I noticed an increase in speed on virtual machines running from a normal HDD. Clearly even if Windows has enough memory it is using swap/page file, so having the page file on a SDD disk is very beneficial.
- Kernel (and applications) no longer has to block for a relatively long time while waiting for IO. This is a problem with HDD because even if there are free resources on the system the whole process will hang while waiting for IO. When the wait is lower the app is much more responsive.
- I chose to buy a disk which was fast in read and write (285MB/s read and 275MB/s write). There are some disks that are faster in read and much slower in write. For most users the slow write won’t be noticed because of Windows write cache so I don’t think its necessary to put too much weight on write speed as long as it is ok. 90% of disk IO is probably read anyway.
So is it all good?
- The 60GB drive I bought shows up as 51GB.
- After installing Windows 7 Ultimate + Windows Update, Office 2010 Professional, Visual Studio 2010 Ultimate, setting up email (a few GB of data) and installing the usual utils (a few browsers, 7-zip, notepad++, paint.net, daemon tools, etc) I was left with 7,5GB free space. Even not counting Visual Studio and stuff there is less than 30GB free. I would guess I need a 100-120GB SSD to be fully happy. But that is not a problem. Another 60GB disk mapped as "C:\Program Files” on the first disk will only increase speed even further. Do I dear run it in stripe?
- It is expensive. You get 1500GB HDD for the price of 50GB SSD.
Now the question is this: Are SSD disks safe enough to run in RAID STRIPE?