I first started using El Capitan when the public beta was released. I continued to enjoy the snapping operating system until one day my laptop's SATA cable decided to give up on me. I got the cable replaced and then ended up having to reformat everything and restart over. That's when I made the decision of moving from the public beta to the official release, because I had been facing minor bluetooth connectivity issues. Ever since then, my computer has been horrible slow, freezing every 4 - 5 minutes for 20 - 30 second durations. I believe this is also called "beach-balling". Anyhow, I started to notice that every time my computer freezes, there is a "Spotlight: XPC Connection Invalidated" error in my console. Every single time. That can't be any coincidence. I've also managed to do some google searches and many people seem to face this problem. However, no one has been able to fix the problem.
These are my final days of IB, meaning I need to be submitting my final documents soon and I really need this computer to be working. I hope somebody out here can help me, I'd be more than willing to conduct any debugging tests and providing any information that can help.
Edit:
DriveDX Log:
Advanced SMART Status : FAILING
Overall Health Rating : AVERAGE 53.3%
Overall Performance Rating : AVERAGE 53.3%
Issues found : 3
=== PROBLEMS SUMMARY ===
Failed Indicators (life-span / pre-fail) : 0 (0 / 0)
Failing Indicators (life-span / pre-fail) : 1 (0 / 1)
Warnings (life-span / pre-fail) : 2 (2 / 0)
Recently failed Self-tests (Short / Full) : 0 (0 / 0)
I/O Errors Count : 0 (0 / 0)
Time in Under temperature : 0 minutes
Time in Over temperature : 0 minutes


Spotlight: XPC Connection Invalidatedmessages are unrelated to the hard drive issue and caused by an indexing issue (I found this question while researching that message, not a HDD problem). For those finding this page by mistake, more info on the Spotlight thing here: http://theoveranalyzed.net/2015/12/3/how-to-force-spotlight-to-index-markdown-files-in-el-capitan – apraetor Nov 14 '16 at 16:50