Very slow performance under Yosemite on Mac mini caused by systemstatsd I've got a late-2009 Mac mini that has begun to perform very poorly after some time on Yosemite. Safari takes about a minute to launch occasionally, as an example.

Granted, I've got a number of background tasks running (Dropbox, BitTorrent Sync, AirServer), but that's unchanged compared to before upgrading to Yosemite. 

My main suspect is the very high network usage. The process kernel_task is using a lot of LAN bandwidth, occasionally downloading 60 MB (that's megabytes)/s for a few seconds before going down to zero, for no apparent reason. The total amount of bandwidth used has exceeded 14 terabytes (!) after a couple of weeks of uptime.

I've got a NAS that I use for sharing files and backups, but since the process using the bandwidth is kernel_task, I don't know what to think.

Update: As a temporary workaround I have setup a script to clear the systemstatsd files mentioned below regularly, but the root cause remains unresolved. 

Today I noticed three things:


In three days, total downloaded data amounts to 3,300 GB. 
Currently, approximately every 12 seconds there is a boost in network activity, where something maxes out the Ethernet interface for a couple of seconds. 
Quitting the BitTorrent Sync app made item number 2 go away. 


My theory is then: there's some bug in BitTorrent Sync that causes it to go nuts on the network, which in itself uses quite some system resources. This in turn causes systemstatsd to hiccup, which creates the final burden on the system.
The culprit was indeed systemstatsd. The way I understand it, that process both produces a number of system stats, dumps them into a file which it later analyzes. For some reason, that file never got reset, resulting in a giant stats file that took serious resources to analyze.

What I did was stop the analysis daemons,

sudo launchctl stop com.apple.systemstatsd
sudo launchctl stop com.apple.systemstatsd.analysis


remove the stats dump file (which was about 3 gigs in size at the time)

cd /private/var/db/systemstats/
sudo rm snapshots.db


relaunch the daemons

sudo launchctl start com.apple.systemstatsd
sudo launchctl start com.apple.systemstatsd.analysis


I never figured out why that dump file never got cleared, but suspect it'd something to do with the PRAM, so for good measure I finally reset it by rebooting and pressing CMD, ALT, P, R when the boot chime was heard until it was heard a second time.

The end result is a mac that is very much snappier than before. Here's hoping that zapping the PRAM did eliminate the root cause.

Further reading: What is the use of snapshot.db?