Beach balling for no reason?

splitpea

macrumors 65816
Original poster
Oct 21, 2009
1,003
226
Among the starlings
Help! My Mac has been beach balling on almost every context switch, and I can't see any good reason for it, since it's got plenty of free resources:

- CPU usage under 5%
- 4gb free memory
- 175 gb free disk space

I've been running activity monitor to try to track down the problem, but I'm not seeing CPU spikes or even I/O spikes associated with the freezes. The problem seems to be worst for about half an hour immediately after boot (even after all startup programs seem to have loaded) or wake from sleep/hibernation.

Early 2010 MBP running Snow Leopard.

Any suggestions?
 

splitpea

macrumors 65816
Original poster
Oct 21, 2009
1,003
226
Among the starlings
So, figuring I had nothing to lose, and since I've been doing a LOT of disk writes lately (developing and testing a script to migrate a large database) I decided to try defragging my hard drive. I also uninstalled a couple of startup items (a really obnoxiously unnecessary Belkin utility, for instance).

I know that OS X defrags smaller files automatically, but I've got a lot of large files, and a large quantity in places the system may not fiddle with by default (e.g. MySQL databases). This seems to have been a good move. The defragging utility indicated that my Mail.app envelope index, for instance -- one of my most frequently read and written files -- was in almost 20,000 fragments.

The results are brilliant. The system is still slower than I'd like it to be or when I first got it, and still beach balls on some operations immediately after boot, but it's no longer completely freezing on those operations. The problems with context switching seem to have gone away, and boot time (including startup item load after login) dropped by about 75%.

Of course, that doesn't mean the drive isn't dying. I'll keep taking frequent backups, naturally.

Thank you for your help!