I’m getting an increasing number of “Deadlock” and “Lock timeout” issues on my MySQL database (an Amazon RDS instance). The database was working very well until a couple of days ago. No changes to the server code (that executes the queries) were made for more than a week. I know what the exceptions are, but I’m at a loss as to the best way to debug and find the specific queries/statements that are causing the issues.
Info on setup:
- MySQL Amazon RDS instance (small)
- Everything default in RDS profile/MySQL settings except for character encoding, which is changed to UTF-8
- Server making the queries is Tomcat Java server with Hibernate
- Information on exceptions is read from the Tomcat server log
- Queries / Min between 50 – 5000
My best guess is there’s something in the settings (either Hibernate or MySQL) that’s causing this issue. The server will run fine and then latency will go through the roof causing all sorts of negative behavior. When this happens, the CPU utilization of the instance will be near 100%.
The hibernate settings are:
Any idea where to start debugging of if something in the settings might be causing this problem would be appreciated.
I know it hard to locate the problem but you can start with locate the query that cause a deadlocks using:
SHOW FULL PROCESSLIST
Hope this will help you to start