Saturday, January 21, 2012

OS X Lion on an older, early 2008, black, 13 inch, MacBook, and Performance Issues Solved

I have recently been fighting with OS X Lion regarding performance on my older, early 2008, black, 13 inch MacBook (2.4GHz Intel Core 2 Duo, 4G RAM upgraded from the stock 2G, and a 500G WD Scorpio Black 7200 RPM drive upgraded from the stock 256G 5400 RPM drive.).  The only change was the upgrade to Lion.  Here is what I have observed:

  1. Using Menu Meters and the system's Activity Monitor, I have observed performance, and computer behaviour correlated with application usage.  Typically I run quite a few applications constantly: Mail, iCal, Address Book, Adium, Evernote, Synergy, Skype, Fastscripts, SizeUp, Time Machine, OmniFocus, Dreamweaver or Photoshop, iTunes and BBEdit.  I should also note that I typically run a 25" Asus monitor as well as the MacBook's internal monitor.
  2. After upgrading to Lion my computer started to have a number of performance issues.  Most annoying was a frequent, several second pause.  The entire computer would appear to freeze for a number of seconds.  Not an hesitation, but a full-blown pause.
  3. When I had the large monitor disconnected, and was just running the internal monitor, these pauses were almost non-existent.
  4. The fans would come on much more frequently than usual.  Prior to Lion, my fans would come come on only when Time Machine ran to sync with my constantly connected (by Firewire) 1TB WD Green in a NexStar single drive dock.
  5. I did a lot of research on the Web, and found a number of interesting, related, and useful links.  Some of the topics which were useful included Apple's 'Mingler' process, Safari's 'Safari Web Content' process, OS X swap file usage, older Macs unofficial RAM capacities, onboard vs dedicated video RAM, the 'purge' command, and OS X performance issues in general.
  6. Using menumeters I observed that my system pauses were related to physical RAM usage.  When the RAM meter hit the 'full' mark, my system paused.
  7. Using menumeteres I observed that my fans came on when my CPU usage climbed.  This CPU usage did not cause a pause or hesitation.  Just the fans came on.
Here is the answer:  Some of the changes in Lion are specifically suited to the new Mac hardware architecture.  If you look at the Activity Monitor's System Memory display, show All Processes, and sort by Real Memory, you will see that certain things always float to the top:  mds, WindowServer, and kernel_task are processes belonging to the system, and you probably don't want to screw with them.  Application-related processes you'll see near the top all the time are Mail, Safari, and Safari Web Service. That's it, and there you are!  It's an old Windows problem.  When the OS is swapping to the hard drive, that is, physical RAM is being exchanged with virtual RAM (data on the hard drive), the system comes to a halt until physical RAM is freed up.

This problem is also related to video usage, by the way.  Mac's in the Pro line - those with NVidea video chipsets, and dedicated video RAM, do not suffer from this problem to the same degree.  Those with the onboard Intel video sub-systems, which share RAM with the other processes on the system, don't have enough physical RAM to handle the massive RAM, and video RAM usage of Lion, so they swap to virtual RAM on the hard drive, which is really, really slow in computer time, so that's why there's a hesitation.

Here is the solution:  More RAM (or fewer processes, and smaller screens).  After a bucket of research, I found this 4G stick at OWC, which, according to their chart, and other information (some of it from Apple), is unofficially supported in my early 2008 model alongside a 2G stick.  In other words, I got my little black MacBook up to 6G of RAM, and that solves the problem most of the time.  If things get sloppy, I restart Mail, and Safari.  If they get really horrible, I shut down Mail, and Safari, and run 'purge'.

Caveat: If you want to go this route, check that your Mac will take the extra RAM (You need 6G for Lion to be happy on a busy box like mine.), and make sure you understand what the 'purge' command does before you use it.

Note: I also tried Geek Tools instead of menumeters, but it seems to have a larger footprint in memory.