MacOS – Optimize macbook pro for internal SSD+HDD drives

macosssd

I upgraded my MacBook Pro by replacing the SuperDrive with an SSD. I'm now using the SSD as the boot volume and have all my applications. My home folder is on the HDD.

My question is how to best optimize my setup for speed/performance/lifetime.

A few specifics questions

  • Is the SSD the ideal location for applications?
  • Where should the swapfile be located? Will it decrease the lifetime of the SSD?

My computer's specs

A screenshot of Lion's System Information front page describing a MacBook Pro 15", Mid-2010 with a 2.66 GHz Intel Core i7 processor, 8 GB of 1067 MHz DDR3 RAM, a NVIDIA GeForce GT 330M graphics card with 512MB of VRAM running Mac OS X Lion 10.7.1 (build 11B26).

Best Answer

Is the SSD the ideal location for applications?

The SSD is the ideal location for all your data. However, if you are short on room (as are most SSD owners), "offloading" some of the bigger and more generic files types (music, movies, etc.) is recommended and won't adversely affect the performance of your day to day.

However, with that said, having your home folder on a separate drive may be overkill as there are many small files housed there (application preferences, program caches, and other miscellany) that help your software and system function efficiently, and in doing so, you may inadvertently decrease your performance moderately to quite substantially in some cases.

Also bear in mind that OS X will create tmp files as needed and even juggle things back and forth depending on the demand and this is all written to the drive where your system is installed (places like /var/tmp, etc.). And truthfully, there is little point in purchasing an SSD to make use of its benefits if you are going to offload everything. SSDs are cheap these days and all have longer warranties (most are 5 years) than most traditional HDDs.

Where should the swapfile be located? Will it decrease the lifetime of the SSD?

Leave the swap file alone. One of the first things new SSD owners do is scour their systems looking under ever nook and cranny for ways to prevent read and writes (read: slow cell wearing), ultimately in an attempt to lengthen the life of their drive, as if they had only a few short months (BitMICRO actually debunked some of the myths around SSD life-span). This is an impossible task. OS X (and all other OSes) perform millions upon millions of small read/writes to and fro in their tasks.

Files are cached multiple times over and a lot of "voodoo" is done under the hood. Lion, with Versions, local Time Machine backups, etc. doubly so. It will drive you towards insanity if you constantly worry about read/write cycles and all those that suggest the disabling of swap, running without atime, or even creating a RAM disk, are just peddling snake oil (however, there are some optimizations you can perform to free up space or reduce SSD wear, but the do often involve disabling services, which some may find useful). None of them ever present real, hard data on their performance increases. My car drives way better after it's had a good wash and detailing, but clearly, soap and water don't tune engines. It's a placebo affect and it is quite strong.

Now the new trend is TRIM. Firstly, the only genuine article on the subject (which has been criticized to some extent, though no one has debunked it outright) shows that OS X benefits very little from TRIM. Secondly, TRIM enabler (developed by Oskar Groth) has been a point of contention lately, with some claiming the installer is inherently flawed. Grant Pannell took it upon himself to fix it. But one question still remains: Does OS X need TRIM? And if that's a resounding "yes," under what circumstances?

It is now the case that many SSD manufacturers are putting their own garbage collection routines right on the drive. All SandForce chipsets come with something dubbed recycler, "which intelligently performs garbage collection with the least impact on flash endurance" (and it is now the consensus that TRIM shouldn't actually be used for any SSD with these controllers). Therefore, adding TRIM only serves to add overhead and decrease performance, albeit only slightly (based on my own testing using XBench and HD Speed Test). Other manufacturers, like Kingston, are also following suit by adding native garbage collection right on the controller (though this is nothing new). Therefore, it's not enough to flip the switch on TRIM and assume it's to your benefit.

While the net is filled with misinformation and rumour, one particular person (Hyram) as posted some interesting information on the topic. You can head over here to read more about what he has to say as to why exactly Apple has not elected to enable TRIM for all SSDs (be sure to read his follow up comment as well, just a couple below). He talks of the following in his initial post:

Apple locked TRIM support for a very good reason — their code works reliably with the SSD’s they’ve chosen to use and no others, because they have programmed in nanosecond-critical timing loops that match perfectly with the access timings of the controllers used in Apple’s SSDs. Using these drivers with other controllers can, at best, slow them down, and at worst, increase the thermal effect that kills storage cells by forcing the controller to act when it isn’t quite ready. This thermal increase hastens the death of the SSD, reducing the already-low lifespan down to six months, if not less.

Then there is the Sandforce issue. SSDs which use one of Sandforce’s DuraClass controllers (SF1200 or better) do not need TRIM at all, as they have their own garbage collection and wear levelling system built in which uses parallel writes, as there are actually two sets of chip controllers built in — whilst one is satisfying the demands of the host in reading & writing requested data, the other is autonomously managing the solid state arrays, shifting regularly-accessed data into new cells, updating block indexes and generally spreading the workload around to ensure thermal effects are kept to an absolute minimum. By enabling TRIM, the SSD is forced to work twice as hard as there are now two separate element management systems running, one from the OS and one built into the device itself. This dramatically increases thermal damage, and again, reducing the life-span of the drive.

While no one has officially confirmed whether he's on the mark or not, you'd have to be quite thick to completely ignore his warning. To put it bluntly, it does make sense. If the issue is nothing more than telling a kernel extension to flip the switch on TRIM for all SSDs, it wouldn't make much sense for Apple not to do it. Many would counter-argue that Apple does it so you'll buy their high-priced SSDs, but from my experience, Apple is in the business of expanding the user-experience, not stifling it. There exist a myriad of cheap, 3rd party peripherals on the market (from video adapters to mice and keyboards) and Apple has not blocked any of them from working optimally. Why would they start with SSDs? Clearly there is more going on here.

I urge you to look into your SSD and find out if it has on-board garbage collection. And even if it doesn't, I would give TRIM a second thought. It is my understanding and interpretation that TRIM is a deprecated system, in favour of much more efficient on-board garbage collection.

In all honesty, SSDs all carry a minimum 3 year warranty (most manufacturers have bumped it up to 5) and should the drive fail before then, you will receive a new one. Anandtech has written an exceptional article on the current state of SSDs that you may find useful, but even such things shouldn't frighten you. Just make regular backups and enjoy your new drive, balance the limited space of course.