I have a Magento PHP store on a dedicated VPS with MySQL colocated on it. It is working fine 95% of the time. Every few days I get a cluster of errors:
"SQLSTATE[HY000] [2002] Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)" reported by parts of the application that normally work fine.

The clusters involve typically ~10 failures over a period of no more than a minute or two. This is happening once every three or four days on average at apparently random times of the day. It does not appear to be related to the particular query.

The system 'recovers' and everything continues fine. The store is doing reasonable business but I'm worried that these failures could mean lost customers.

I can supply more details on the issues but I'm really asking how/where to dig further, assuming nobody can tell me its 'setting X'. I can't reproduce the problem on a local server and I can't afford the slowdown of MySQL logging on the live server where the error occurs.