Incredibly slow user interface and incredibly high disk writes
My late-2013 Macbook Pro 13" has been increasingly laggy and slow for the last several months. Replacing the SSD helped a little, but now it is beach-balling even opening a single new tab. Overall CPU usage is low (mostly WindowServer) but I was alarmed to see the amount of disk writes that kernel_task is doing (about 20GB per day).
Checking with smartctl then showed that over the 4 months since I replaced the SSD, it has done over 70TB of writes! I have no idea what it could be writing. My usual apps are Google Chrome, Terminal, Preview (for pdfs) and TeXshop and background apps (Dropbox, Google Drive, etc). How can I figure out what is lagging everything/causing kernel_task to do so many writes?
It's probably Dropbox or Google Drive. I've seen similar problems. Typically it's caused by Dropbox or Google Drive repeatedly downloading the same files over-and-over. They are both somewhat buggy programs.
Do you have any symbolic links in either your Dropbox or Google Drive? Neither deal well with symlinks; Dropbox specifically does not support them. (See https://www.dropboxforum.com/t5/Files-folders/Symbolic-link-on-Mac/td-p/27496 and https://help.dropbox.com/installs-integrations/sync-uploads/symlinks).
You can find symbolic links from the Terminal with this command:
find $HOME -type -l -print
or to see where it points:
find $HOME -type -l -ls
You can also run a program that monitors all writes to your hard drive by file, to diagnose the problem youself. Turn off System Integrity Protection and run opensnoop or iofileb.d.