How can I diagnose really poor performance of my 13" MBP 2011 on 10.6?

The specs are:

  • 2011 MBP 13"
  • Core i7
  • 4Gb RAM
  • 320Gb HDD (not SSD)

I use the system for work everyday, I almost always run the following:

  • Mail.app
  • Chrome (7-10 tabs)
  • Terminal (2-3 sessions)
  • Skype
  • TextEdit (2-3 docs)
  • Adium (5 accounts across gTalk, Jabber, MSN)
  • Finder (1-2 windows)
  • PGP Encrypted Drive

Occasionally (less than 50% of the time) I also run:

  • Firefox (2-3 tabs)
  • MAMP (Apache / PHP / MySQL)
  • LibreOffice (1-2 docs)
  • MS Office (1-2 docs)

I have a menu bar icon that constantly tells me CPU / Memory usage. Best case scenario, almost after I've booted up and turned on the minimum amount of my always on apps, I'm using 2-2.5gb RAM.

After a few hours I'll be up around 3gb and it'll generally stay around that point, where loading any app seems to be much slower than required and try to run heavier stuff like Excel / Calc or VMWare Fusion is almost unusable and takes years to actually get up and running.

Once the memory gets 3gb+, I often get system freezes (throbbing mouse, no apps respond) for 5-10 seconds, and a massive spike in CPU Usage for the 5-10 second period.

I'm in an office of about 10 people, and all of us run very similar applications, including the PGP Disk Encryption.

I'm wondering if anybody could give pointers on improving performance, or how to diagnose poor performance on OSX? At home I'm a Windows/Ubuntu person, and I feel like I've figured out how to diagnose any performance issues I get on those platforms, but in the OSX world I feel totally inexperienced.

Thanks for any tips.


Solution 1:

When the wired and active RAM pass 50% - most tasks are measurably slower. You will see increased paging activity (vm_stat 15 in the terminal - watch for page outs - they indicate some memory had to be written to slow hard drive and constant page out and page in above 10-20 per minute indicates you have a RAM starved system.)

When starved for RAM, you can buy more or do less. You might want to get a monitoring software like Activity Monitor and keep the memory indicator in your dock. The system is likely thrashing based on the time delays you report. Each of the active programs needs some memory that just got paged to disk to free up extra space for memory needed by another program. It is a bad cycle and the computer just spends time running circles rather than getting done the work you wanted.

Here is a mac with every indication of RAM pressure:

time for more RAM

But, quitting a large app like Aperture and starting it again still has no paging and the system is very responsive. Ignore the first line after the headings in vm_stat as it's the total since boot, but do watch for pageout as you have apps that are not responsive:

mac:~ me$ vm_stat 15
Mach Virtual Memory Statistics: (page size of 4096 bytes, cache hits 0%)
  free active   spec inactive   wire   faults     copy    0fill reactive  pageins  pageout
260482  1186K  74303   275275 234520  323478K  2276158  188709K   120292   640158      482 
260689  1187K  74303   275275 234038     4117        0     3256        0        0        0 
261310  1185K  74001   275250 235835    10668       77     7115        0        4        0 
292087  1153K  74711   274313 236770    32927      972    21684        0       18        0 
521469 928347  75754   269861 235897    77208      130    63300        8       41        0 
517897 936518  75766   269215 231981    27678     2504    13059        0       22        0 
463894 987202  72076   274852 233371   126855     2712    89422        2       50        0 
223701  1180K  77834   283568 265396   589512      255   562957        1     7278        0 
205013  1186K  82765   291561 265293   389442      255   369664        0     7334        0 
201401  1173K  89671   301672 265595   495426       82   472316        1     9286        0 

However, starting about 4 of the Adobe CS4 apps can push this machine into thrashing and the slowness you describe with the apps taking 30 seconds to launch and lots of bouncing of square icons in the dock.

dock bounce

Here is the associated vm_stat 15 showing the problem. Look specifically at the free memory plummeting to the minimum and pagein / pageout climbing.

mac:~ me$ vm_stat 15
Mach Virtual Memory Statistics: (page size of 4096 bytes, cache hits 0%)
  free active   spec inactive   wire   faults     copy    0fill reactive  pageins  pageout
 21822  1190K   4746   585056 228411  332621K  2315577  196418K   121439   781551     1806 
 86862  1152K   5123   570803 215710   124555      932   102117        0     2086       15 
 73080  1161K   8631   571301 216607    24404      337    14931        0     1994        0 
 29655  1196K  13500   572024 219284   188966      535   112913        0     3606        0 
  1668  1208K   9616   594723 216954   174145      215   144996       16    15268      121 
  4142  1206K   5795   595393 219564   322750        0   320426        0        1        0 
  3043  1204K   3485   596990 223264   138981      136   136653        0       28        0 
  2338  1205K   2782   598556 222416   332263      321   321321        0      164       30 
  3251  1204K   2919   598770 222027    90135       82    85050        0        5        0 
  2606  1203K    212   600436 224678   114502        1   112450        0       35        0 
  1188  1200K    174   600230 228582   162660      117   157230    33127      860     9914 
 22069  1200K  27612   550547 230304    89953       38    82383     8274      159     2071 
  1910  1200K    349   600071 227976    24382        0    23465     7332        1     2985 
  1164  1201K    174   600281 228423     4940        1     4046     7087        8     2500 
 30404  1203K    186   567418 229475    16087        1    16045     8566        4     2235 

Solution 2:

These are generally the things that I do whenever I have issues with performance. Make sure you have a full backup first, of course.

  • Close all apps. Open Disk Utility, and click 'Macintosh HD' (or whatever your OS X hard drive is named) on the left hand side. Then click verify disk. Let it do its thing, and if it comes back with green text saying that the disk is fine, groovy. If not, locate your original Mac OS X disc that came with your machine. Insert the disc, turn your computer off. Press the power button again, then immediately hold the 'c' key down. This will boot your computer from the CD. When it has loaded, select the language, and then click (on the top menu bar) Utilities -> Disk Utility. Within this, select your OS X hard disk, and click 'Repair disk.' This may take some time to complete. When it has finished repairing, restart your computer into OS X.

  • Then go back into Disk Utility, select your disk, and click 'Repair Disk Permissions.' Again this may take some time.

  • If you don't already have it, get Onyx (here). Open it up, and click the 'cleaning' tab. Select and execute whatever caches or histories you wish to clear. They are all safe to clear, causing no change to your laptop, just apps may require a few seconds longer to start immediately after the clean.

  • Make sure that your hard disk is not full of junk that you do not need, and is not too full. Empty the trash.

You should hopefully notice an increase in battery life as well after these processes.

Hope this helps!