I'm running a bunch of scripts in parallel that do:
START TRANSACTION REPLACE INTO... REPLACE INTO... REPLACE INTO... ... COMMIT
On my 8-core machine, where 8 of these processes are running in parallel, about 1% of the processes die with a deadlock complaint from MySQL. That is, about 10,000 out of the 1,000,000 jobs I'm running die this way:
umysql.SQLError: (1213, 'Deadlock found when trying to get lock; try restarting transaction')
On my 16-core machine (actually a Google Compute Engine machine), I get no deadlocks.
Both machines are running the same version of MySQL on the local machine where the processes are running.
I expected the 16-core machine to have more deadlocks since there are more processes running in parallel. Why would the 8-core machine have more deadlocks than the 16-core?