Wednesday, September 26, 2012

Macbook Pro runs hot with SSD and TRIM Enabler

The first problem


In a recent upgrade to my Macbook Pro (15-inch, early 2011), I swapped out the standard 2.5" HDD for a OCZ Vertex 4 SSD, which has a Sandforce controller Indilinx Everest 2 controller. I also did a clean install of OS X 10.8 (Mountain Lion) on the new drive.

I installed a hard drive performance benchmarking tool (Blackmagic Disk Speed Test) from the App Store and was pleased to see 500 MB+/sec read and write speeds, and my battery life on full charge went up to almost 6 hours! Then I encrypted the volume using FileVault 2 (Mac's built-in encryption utility; works very well). I rebooted, and did another speed test.

Write speeds were down to about 220 MB/sec and read speeds were just over 300 MB/sec. Performance had dropped drastically. Apparently, the FileVault encryption was interfering.

Background


Doing a little research turned up results that Sandforce-controlled SSDs, in Macs, may have trouble performing well when FileVault is doing its pass-thru (or "on-the-fly") encryption. Fortunately, this isn't a Sandforce-controlled drive. So why was this happening?

One possibility: SSDs should have a low-level command called TRIM which improves performance when writing to non-empty blocks on the drive. In a traditional HDD, writing to a non-empty sector has no (measurable) performance hit, but on an SSD, there's some technical reasons that writing to a non-empty block is slower than writing to an emtpy block. TRIM tidies things up after data is "deleted" so that write speeds are quick in that area later. Thus, enabling TRIM manually on Macs, whether there really is trouble or not, should theoretically help boost performance.


TRIM Enabler, the solution .... or is it?

I downloaded the nifty TRIM Enabler program and turned on the TRIM command with an easy switch-flip. After a reboot, I waited about an hour then ran a benchmark test. Performance was back up to 300-350 MB+/sec. Read speeds were even a little higher. I was very pleased. But a few days later, I noticed that my Macbook Pro was running hot and the battery life dropped from about 5.5 or 6 hours to 2 or 2.5, and the fan was spinning hard.

The CPU wasn't running out of control, and I couldn't narrow it down. I suspected it was SSD- or TRIM-related.

The fix to my Macbook Pro running hot / bad battery life

I simply disabled the TRIM command again in TRIM Enabler tool. Now, a day later, my MBP is running at normal temperatures, and battery life is back up to the high marks I was hoping for.

I suspect that the issue wasn't so much with a faulty SSD, but rather that there was some sort of initial lag in performance after encrypting. I don't know why I think it was Spotlight indexing all my files quickly, so the processor had to keep up -- but now a few days later  and without TRIM Enabler on, my benchmark tests show high read and write speeds, again up past the 350+MB/sec mark and my battery life is normal.

tl;dr Just be patient after encrypting your SSD with FileVault. Performance will probably go back up after a day, and the hit isn't too notable unless you're doing specific benchmark testing. TRIM Enabler probably isn't needed (with Vertex 4 SSDs).