Bug #115475 CPU spike when we use mysql-connector-java version 8.0.33 with Mysql DB 5.7
Submitted: 1 Jul 15:52 Modified: 9 Jul 5:13
Reporter: Kishan Kumar Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / J Severity:S5 (Performance)
Version:8.0.33 OS:Any
Assigned to: CPU Architecture:Any

[1 Jul 15:52] Kishan Kumar
Description:
Hi Team,

We are in the process of upgrading our Mysql DB Instance (Aurora Instance) from 5.7 to Mysql 8.0 (Aurora version 3.0). In this process we are following below approach
1. Upgrade the Mysql java connector in our application which are using older version to 8.0.33
2. Roll out this change to production to validate the change is not having any issues.
3. If no issues found, upgrade the Db to 8.0 

We completed step 1 and 2 in our production environment. But the last step 3 could not be done as we see a spike in CPU utilisation when mysql-connector-java 8.0.33 is talking to Mysql DB 5.7. We see lot of waits induced for "checking permission". This spikes up the CPU utilisation

We did one more test , where we upgraded the DB to 8.0 and with same change, we are not seeing the CPU spike. So the issue is with below combination

Mysql-connector-java 8.0.33 with Mysql DB 5.7.  - has Issue of CPU Spike

Mysql-connector-java 8.0.33 with Mysql DB 8.0.  - No issues.

Mysql-connector-java 5.1.* with Mysql DB 5.7.  - No issues.

 

How to repeat:
Create an java application which talks to Mysql DB 5.7 using connector mysql-connector-java 8.0.33. On the performance metrics, we see CPU spike.

Lot of calls of SHOW FULL TABLE is seen, which were not happening earlier.

Suggested fix:
We need to resolve the CPU Spike.
[2 Jul 13:03] MySQL Verification Team
Hello Kishan Kumar,

Thank you for the bug report.
Please note that MySQL 5.7 is covered under Oracle Lifetime Sustaining Support.
For more info please see https://www.mysql.com/support/eol-notice.html

Also, Mysql-connector-java 8.0.33 and Mysql-connector-java 5.1.* are quite an old version. Please upgrade to latest version. Thank you.

Regards,
Ashwini Patil
[3 Jul 12:00] Kishan Kumar
Hi Team,

We are already using the latest version of 8.4 and we see the same issue there as well.
[3 Jul 12:38] MySQL Verification Team
Hello Kishan Kumar,

Could you please provide repeatable test case (exact steps, sample project, etc. - please make it as private if you prefer) to reproduce this issue at our end?

Regards,
Ashwini Patil
[9 Jul 5:12] Kishan Kumar
Hi Team,

This issue is resolved. We have to use nullDatabaseMeansCurrent=true when we are using the new connector version. By default in connector version 5.* this was enabled by default. In version 8 and higher, this has been removed and it queries the entire Databases to look for table metadata. This caused CPU spikes.

Closing the issue for now.
[9 Jul 5:13] Kishan Kumar
The issue has been resolved once we started using nullDatabaseMeansCurrent=true in the connection string
[9 Jul 6:17] MySQL Verification Team
Thank you for the feedback.