I have a MySQL 5.5.23 DB that performs about 3k qps, 5% of which are writes. Lately, I've been having a big problem with random write freezes. Everything is going great, and then all of a sudden any write that comes in stops in the "update" or "Updating" state. They stay in this state for about a minute or two and then finally finish. The problem is that with such high amount of connections, when they freeze randomly like this, the connection stays open and then I inevitably get too many connection errors.
It's happening on all tables during both INSERT and UPDATE queries.
Has anyone seen this before? Is there anything that can be done about it?
I'm using Amazon RDS with the biggest instance they offer. I'd be more than happy to provide any information you guys need, just let me know what that is.
UPDATE: The main table I'm inserting into is:
CREATE TABLE `mytable` (
`hash` varchar(5) CHARACTER SET latin1 COLLATE latin1_general_cs NOT NULL,
`name` varchar(256) DEFAULT NULL,
`ip` varchar(64) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
`deletehash` char(15) CHARACTER SET latin1 COLLATE latin1_general_cs NOT NULL,
`datetime` datetime NOT NULL,
`api_key` varchar(64) CHARACTER SET latin1 COLLATE latin1_general_cs DEFAULT NULL,
`account_id` int(10) unsigned DEFAULT NULL,
`type` varchar(15) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
`width` int(10) unsigned NOT NULL DEFAULT '0',
`height` int(10) unsigned NOT NULL DEFAULT '0',
`size` int(10) unsigned NOT NULL DEFAULT '0',
`animated` tinyint(1) NOT NULL DEFAULT '0',
`views` int(10) unsigned NOT NULL DEFAULT '0',
`lastviewed` datetime NOT NULL,
PRIMARY KEY (`hash`),
UNIQUE KEY `deletehash` (`deletehash`),
KEY `datetime` (`datetime`),
KEY `account_id` (`account_id`),
KEY `ip` (`ip`),
KEY `api_key` (`api_key`),
KEY `views` (`views`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8
Sample insert:
insert into mytable (hash, name, ip, deletehashe, datetime, api_key, account_id, type, width, height, size, animated, views, lastviewed) values('abcde', 'file name', '127.0.0.1', 'abcdefghijklmn', '2012-05-31 00:00:00', NULL, NULL, 'mime/type', 0, 0, 0, 0, 0, '0000-00-00 00:00:00');
Sample update:
update mytable set views = views+1, lastviewed = NOW() where hash = 'abcde';
INSERT
and anUPDATE
.SHOW ENGINE INNODB STATUS\G
during a lockup?