SELECT ... FOR UPDATE uses 100% CPU since 8.0.21-12

Description

Executing SELECT ... FOR UPDATE statement, causes high CPU spikes (it does not matter, whether table is empty or there are any rows.)

Sample table:

Query:

 

It causes ongoing 100% CPU usage, when query is executed in interval (e.g. every 1s).

Naive bash script for bug reproduction:

 

I have tested with following docker images (with default configuration):

Docker Image

High CPU

mysql:5.7

NO

mysql:8.0

NO

mariadb:10

NO

percona:5.7

NO

percona:8.0.12-2rc1

NO

percona:8.0.20-11

NO

percona:8.0.21-12

YES

percona:8.0.22-13

YES

percona:8.0.29-21

YES

percona:8.0.32-24

YES

percona:8.0.33-25

YES

It looks like, the performance degradation was introduced in percona 8.0.21-12.

 

Attachment percona-high-cpu-select-for-update.tar.gz contains docker-compose with mentioned database setup and bash script. 

 

Related Issues:

Environment

None

Attachments

5

Activity

Thomas Gerbet 
June 5, 2024 at 1:49 PM

I encountered the same issue (and created a duplicate because I did not found this issue first )

Anyway, if it can help the troubleshooting I have flamegraph of Percona and MySQL running the same workload of SELECT ... FOR UPDATE queries available here:

Aaditya Dubey 
October 9, 2023 at 11:56 AM

Hi ,

Thank you for the report and feedback.
Verified as described:

Only Percona server is impacted by this, sending the concern to engineering for further review and updates.

Details

Assignee

Reporter

Regression Issue

Yes

Priority

Created July 8, 2023 at 1:23 PM
Updated August 31, 2024 at 10:50 AM