I've got an issue that's causing very long "time in database" in my application.
The DB is Percona MySQL 5.5.35.
The application works perfectly, and can read/write from the database just fine. The issue is that I have extraordinarily long DB response times that's definitely not time spent executing the queries, which are all simple, and cached.
For instance, I'll randomly get response times go into several seconds, and other times, it takes just a few milliseconds. There is slow query logs setup and no queries are slow, they're all simple inserts of tiny data and about 80% reads, the entire DB is just 20MB, it's an internet forum.
I'm certain the problem is down to the socket, as I cannot have the socket specified in the mysqld section of my.cnf. If I do, I get an error upon restarting the database saying:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
So for example, here's the live, working copy of my.cnf, with irrelevant portions removed:
[mysql]
# CLIENT #
port = 3306
socket = /var/lib/mysql/mysql.sock
[mysqld]
# General #
default-storage-engine = InnoDB
# Database replication #
server-id=1895149
log-bin=mysql-bin
log-error=mysql-bin.err
binlog_do_db=reefbase1
# MyISAM #
key-buffer-size = 32M
myisam-recover = FORCE,BACKUP
Notice the port and socket isn't specified in mysqld section?
If I change this to:
[mysql]
# CLIENT #
port = 3306
socket = /var/lib/mysql/mysql.sock
[mysqld]
port = 3306
socket = /var/lib/mysql/mysql.sock
# General #
default-storage-engine = InnoDB
# Database replication #
server-id=1895149
log-bin=mysql-bin
log-error=mysql-bin.err
binlog_do_db=reefbase1
# MyISAM #
key-buffer-size = 32M
myisam-recover = FORCE,BACKUP
Which is how I see over and over again, my.cnf to be setup, my server fails to start with the "cannot connect" error.
Any advice would be very much appreciated.