Question: I’m experiencing some significant OS X lag when listing directories/files. I originally thought it was purely an issue with Finder, and not the HD or any other part of OS X, however I have since noticed some file access lag with other apps, such as Versions and The Unarchiver, so I really have no idea where the problem lies.
The lag predominately appears to be when listing directories/files in Finder, where I’m seeing anything up to twelve or so seconds of lag (the folder opens with a blank list and the spinner going in the bottom right).
- This happens on two different (albeit very similarly configured) computers
- This happens with both the local SSD and network drives (connected via ethernet or wifi)
- Browsing both local and network drives in terminal and listing directories is instant
- I can actually browse files on my NAS from my phone over a 3G connection from the other side of the country faster than Finder can while connected to the local network
Can anyone help? Thanks.
EDIT:
After testing with the fs_usage command, it appears to be launchd that’s slowing things down. These two lines appeared just after opening two directories that took a very long time to list:
13:23:58.528825 ?select ?S=1 ?4.493972 W launchd.134713:24:58.572283 ?select ?S=1 ?9.954218 W launchd.1347
Any thoughts?
2nd EDIT:
Further fs_usage log with some additional entries:
13:44:26.172945 ?select ?S=1 ?1.157757 W Finder.485413:44:32.653263 ?select ?S=1 ?9.987226 W launchd.134513:44:32.686134 ?select ?S=1 ?1.327516 W dbfseventsd.363913:44:42.152977 ?select ?S=1 ?9.473943 W launchd.134513:44:42.173888 ?select ?S=1 ?9.487425 W dbfseventsd.363913:44:46.135971 ?select ?S=1 ?19.926955 W Finder.485413:44:47.623476 ?select ?S=1 ?1.472648 W Finder.485413:44:48.718721 ?select ?S=1 ?2.344869 W dbfseventsd.363913:44:52.657413 ?select ?S=1 ?1.615911 W launchd.134513:45:12.591938 ?select ?S=1 ?15.687167 W launchd.134513:45:15.359595 ?select ?S=1 ?2.747797 W dbfseventsd.3639
Answer: The comments have already hit upon some common reasons why Finder will become slower such as corruption or a large .DS_Store file or a large number of documents that will cause the system to display previews of each.
If you really want to trace the IO, you can use the fs_usage command to dump all filesystem activity to a terminal window and optionally grep out results from programs you don’t care about and also discarding all the short IO to get a picture of what IO are taking more than a hundredth of a second to complete.
sudo fs_usage -w | grep -v grep | grep -v 0.00
In your edit to your question, the slow IO are not looking like anything suspicious. You can’t really get away from launchd – if it is blocking your IO in finder – that would be because the network filesystems are not responding (or the networking is having issues with packets being delayed for very long times).
Sadly, you may need to browse from the phone client if it really is that much faster than Finder and keep watching the IO. Perhaps if you disconnect all network shares, you might see the slow IO go down and be able to conclude you really have a networking delay / problem rather than a Finder / CPU / local problem. I was hoping something would look amiss in the fs_usage dump – but your results seem normal to me as posted.