shlogg · Early preview
Florian Engelhardt @realflowcontrol

Deadlocks Caused By InnoDB Gap Lock: A REPLACE INTO Gotcha

Deadlocks in MySQL caused by REPLACE INTO statements. Replaced with INSERT ON DUPLICATE KEY UPDATE, solving the issue. Also learned that REPLACE INTO deletes existing records before inserting new ones, triggering delete cascades.

TTFB over all application servers (dashed line is previous period)
In our office we have a TV with a performance dashboard, so everyone can see possible problems in the system at any time. Amongst other things we show the TTFB on this dashboard. Those two spikes are not what you want to see, when you are just about to leave the office for lunch.

  
  
  What happened?

We started looking around what’s going on and found out the following in that order:

the number of workers on the app-server rose dramatically
but the CPU consumption did not
the number of connections to the database reached t...