Tuesday, May 29, 2012

High CPU and I/O activity? Disable Time Machine local backups

Some weeks ago I wrote a blog post about how mdworker can sometimes jeopardize your computer resources. Since then, I experienced an enhancement of my computer's performance. But it was not sufficient.

I'm telling nothing new: I have often read myself how disabling Time Machine local backups as well can have beneficial performance effects. The interesting part is how I realized.

I'm using OS X on two machines: a MacBook Pro and an iMac. The iMac was restored from a Time Machine backup of the MacBook Pro and:
  • I'm using the same applications on them.
  • I'm using the same applications data on them (synchronized using rsync).

This means that, at least as far as applications and the operating systems are concerned, they cannot have diverged so much over time.

Interestingly, though, the iMac performs much better than the iMac, even if the latter has got half the quantity of RAM the former has (8 GB).

I always had issues with Time Machine, mainly because I'm working on huge files and Time Machine does not perform incremental, or delta backups: it backs up the entire file each time it runs and detects a change. In fact, I spend most of the time using virtual machines (for development purposes), Lightroom catalogs and... Apple Mail: all the working files' size of these application is in the gigabyte order of magnitude).

What I hadn't realized (yet) is the huge performance impact of Time Machine local backups. On a daily basis I'm changing gigabytes of data on my hard disk and, as a consequence, Time Machine local backups were generating a storm of CPU and I/O activity. The impact was visible only on the MacBook Pro since Time Machine local backups are enable by default only on laptops. Once I disabled them, I had a huge performance improvement (and, as a consequence, freed up a great deal of space in my hard disk).

If you're running OS X Lion on a laptop, chances are local backups are enabled. If they are, you'll see the fancy .MobileBackups directory in your hard disk root. To disable local backups, just run the following command:

$ sudo tmutil disablelocal

After rebooting, OS X Lion will transition the .MobileBackups folder to .MobileBackups.trash and finally delete it. Depending on its actual size, it will take a certain amount of time. In my case, begin bigger than 100 GB, it took approximately five minutes.

No comments: