Solving iCloud-Related Slowdowns in Lion
I recently solved some maddening performance problems on my original aluminum MacBook running Mac OS X 10.7 Lion, and I wanted to share my findings to help others avoid similar troubles. Most interesting about the problems was the technique I happened on for isolating the culprits, which revolved not around raw performance, but battery life.
I needed to spend the entire plane flight out to Macworld editing a book, but I knew my MacBook’s battery, even though I had just replaced it, would have trouble lasting the long flight from Detroit to San Francisco. So I turned my screen brightness down to the lowest level, shut off Wi-Fi and Bluetooth, and set my Energy Saver settings to their most parsimonious.
But here’s the thing about battery life on modern laptop Macs — it’s driven as much by CPU activity as anything else. That is, your MacBook may feel reasonably snappy, but if one of the Intel Core 2 Duo’s cores is being monopolized by an errant application, your battery life will suffer tremendously.
The worst program from this respect, in my experience, is Firefox. That’s partly because I tend to have a number of open tabs, each of which might have some sort of dynamic aspect generated by JavaScript or Flash and running constantly in the background. But whatever the reason, when I opened Activity Monitor on my MacBook, Firefox would usually be using more CPU than any other application. For that reason, I’ve switched to Google Chrome on the MacBook; Chrome isolates each tab as an independent process, making it easier to see if a particular tab is causing problems and stop it. Even more important, Chrome runs Flash as yet another process called Shockwave Flash (Chrome Plug-in Host), so it’s easy to see in Activity Monitor when
Flash is causing problems and, if so, quit that process.
Knowing this, and since I had Wi-Fi off on the plane anyway, I quit Google Chrome, so the only applications that I was using were Pages, where I was editing, BBEdit, which is what the book is about, and Keyboard Maestro, which I was using to make Pages more keyboard-oriented. I figured this would be a rather minimal load and might give me as much as 4 hours of battery life.
So I was rather distressed when I glanced up at the battery life estimate indicator after 15 or 20 minutes of editing and saw that it was predicting only about 2 hours. What could possibly be eating my precious battery power?
A quick trip to Activity Monitor revealed that a process I’d never seen before, called Mingler, was using nearly an entire core — it was hovering at about 97 percent CPU usage. (Activity Monitor’s percentages are by core, so if you have a 12-core Mac Pro, 12 different processes could each be listed as using 100 percent.) I quit Mingler from within Activity Monitor, made a mental note to figure out what it was, and went on with my work. My battery life estimates improved, but the damage was done, and I was able to work for less than 3 hours.
Roughly the same thing happened on the flight back, but once at home, performance actually got worse, and another culprit reared its ugly head in Activity Monitor. This one was a smoking gun, since its name was SafariDAVClient. Some quick research on the Internet revealed that SafariDAVClient and Mingler are both related to iCloud bookmark syncing. (Although I don’t use Safari as my main browser, I do use it for certain tasks, and iCloud bookmark syncing is a good way to manage the Safari bookmarks on my iPhone.)
Since iCloud stores the master copy of bookmarks in the cloud, I simply turned off bookmark syncing in the iCloud pane of System Preferences, renamed the Bookmarks.plist file in ~/Library/Safari
to oldBookmarks.plist (see “Dealing with Lion’s Hidden Library,” 20 July 2011), and turned bookmark syncing back on. A new copy of my bookmarks was retrieved from iCloud, and I haven’t seen SafariDAVClient and Mingler since. (I assume they’re still doing their job, but with nothing much to do, they presumably launch and quit silently in the background.)
The problem, therefore, was a somewhat corrupted Bookmarks.plist file in Safari that was causing iCloud bookmark syncing to choke in such a way as to use a vast amount of processing power, and, in the process, battery power.
I realize this is all very specific, and if you’re experiencing notable performance problems in Lion, it’s certainly worth seeing if either Firefox or iCloud bookmark syncing is the culprit. But realistically, it’s unlikely that either would be your particular problem. You can, however, use roughly the same technique I did, in terms of keeping Activity Monitor running, with the list sorted by the %CPU column, and seeing if anything unusual seems to be bubbling up at the top of the list.
And of course, if you’re interested in a complete discussion of performance issues on the Mac, Joe Kissell’s “Take Control of Speeding Up Your Mac” is the definitive source. We have a minor update to that title to add Lion-specific information coming very soon; it will be free to all owners of the book.
I had a similar problem syncing calendars—Mingler eating up the CPU and calendars not syncing correctly. I had hundreds of duplicates of some old events. Somewhere along the line I ended up deleting all old events to get syncing working.
Michael Cohen, who wrote our Take Control books about syncing, told me that Mingler is part of the Sync Services tools deep in Mac OS X, so that makes sense. It doesn't seem to be able to deal with corrupt data all that well, though.
As much as I like Chrome, I hate it even more as it is a serious CPU hog, but the real culprit is Flash, no matter the implementation. It can bring my OS to its knees.
I've not found Chrome to be particularly problematic, but my usage may be unusual, since I have a LOT of tabs open normally. Firefox deals with that worse than Chrome. And I won't be able to use Safari for my main browser until Mountain Lion, where it will eliminate the Search bar and just let me type in the main address bar (and hopefully it will do Google's Browse By Name searching, which is what I rely on in Chrome and Firefox).
Had a similar problem with apparent reduced battery capacity, but it was caused by an over active driver for an HP scanner...found it the same way though...yay Activity Monitor. Also came across the gfx card status app...helps to extend time on battery by allowing you to force the integrated GPU to be used, among other things. Great article!
A useful hardware solution could be an external battery or even two for long trips away from the grid power outlet: www.hypershop.com/ has a set of batteries for MacBook, iPad to iTouch. There are several vendors of similar products...
I have seen solar chargers too that should work off cabin windows or overhead lighting, to some extent. There is no surcharge for that, yet.
Either way: getting to Activity Monitor and seeing the dynamics of usage is the enlightened way to go, all round.
I've thought about an external battery, but I'd need it only once or twice a year, so it's hard to justify.
Also rechargeable batteries that rarely get used will die prematurely. Cost per use will be prohibitive.
I use iStat Menu to watch what's going on inside my MacBook. I started up one day and launchd was going berserk (100% on a core). I restarted and it calmed down.
It does eat up some of my menu bar space, but lets me know how my network, HD activity, Memory and CPU load is (you can turn on/off what you want). I find it nicer than activity monitor.
Yep! I like iStat Menus too, on my Mac Pro with big screens, but I don't have enough menubar space on my MacBook for it.
iStat now has an option to have rarely used menus as a sub-menu, so they don't take up menu bar space. You can get everything under a single 20px icon if you want.
Ah, looks like that's a new feature in iStat Menus 3.0, and I'm still using 2.0. Good to know.
Rather than syncing bookmarks to iCloud, try Xmarks (http://www.xmarks.com/).
I decided not to muddy the article with that detail. I in fact was using Xmarks for Safari, and it was complaining constantly of bookmarks being out of sync and having to download a new set. So, I can't prove anything at all, which is why I didn't include it, but it's possible the problem was in fact started by Xmarks corrupting the bookmark file.
Uninstalling Xmarks didn't help the performance issues, though.
It's funny. I always assume that when I have a slowdown on my mac, that I've done something wrong.
For example, when I use evernote, there always seems to be keyboard lag. So, I google keyboard lag and come up with issues with the ipad, not mbp or imac. So I assume it's my fault.
So, on of the hardest things is to determine if it's a software issue or an issue of my unique situation.
Interesting! Let me build up your self-esteem - most performance-related problems are not related to you doing anything wrong. :-) It's possible that they're caused by something you're doing (like running Firefox) but there's very little you can do "wrong" that will cause problems. The operating system should either handle or disallow such user actions.
We recently replaced the battery on the MBP because 2) it said service battery and 2) we were only getting 2-2.5 hours out of it when my wife used to use it for an 8 hour class one Saturday a month. The battery life is now only 2.5-2.75 hours, so I'm not that pleased with the replacement battery.
How much battery life are you getting now?
My MacBook was almost 3 years old, and I doubt I was getting much more than 1 hour on the old battery. The new one can estimate as much as 4 hours, though I've only had it a short time and don't really know how long it might go in ideal conditions. I relatively seldom use it in situations where I can't plug in, so I don't do things to reduce power usage in normal working conditions.
My two cents on this discussion is that whenever I set up an account, my first thing to do is configure Activity Monitor to start at login (hidden checked) with the dock icon configured to show CPU usage history. Most of the time, the icon is almost all black so if something hogs CPU, I will notice the increase of green.