Details
-
Bug
-
Status: Closed (View Workflow)
-
Minor
-
Resolution: Not a Bug
-
11.4.10
-
None
-
Ubuntu 24.04
-
Not for Release Notes
Description
When running sysbench I noticed extra CPU overhead from charset conversions.
I am far from an expert on this topic.
I don't understand why the sessions created by the sysbench client use utf8mb4 for things like character_set_client and character_set_results.
When I run SHOW GLOBAL VARIABLES via the mysql command line client I get this for 10.11.16 and 11.4.10
character_set_client latin1
character_set_connection latin1
character_set_database latin1
character_set_filesystem binary
character_set_results latin1
character_set_server latin1
character_set_system utf8mb3
I think the values above are expected as I have this in my.cnf for both:
character_set_server=latin1
When I run SHOW CREATE TABLE for the sysbench table I see this, and again the charset looks OK:
| sbtest1 | CREATE TABLE `sbtest1` ( `id` int(11) NOT NULL AUTO_INCREMENT, `k` int(11) NOT NULL DEFAULT 0, `c` char(120) NOT NULL DEFAULT '', `pad` char(60) NOT NULL DEFAULT '', PRIMARY KEY (`id`), KEY `k_1` (`k`) ) ENGINE=InnoDB AUTO_INCREMENT=1000002 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci |
But when I run this from the sysbench client: show session variables like "character%"
... then the results for 10.11.16 and 11.4.10 don't match, and that explains why 11.4.10 uses more CPU doing charset conversions. See more references below to utf8mb4 in the 11.4.10 result.
But I don't know why this happens.
For 10.11.16
character_set_client latin1
character_set_connection latin1
character_set_database latin1
character_set_filesystem binary
character_set_results latin1
character_set_server latin1
character_set_system utf8mb3
For 11.4.10
character_set_client utf8mb4
character_set_collations
character_set_connection utf8mb4
character_set_database latin1
character_set_filesystem binary
character_set_results utf8mb4
character_set_server latin1
character_set_system utf8mb3
I enabled the general log and do not see any SET commands that would change session variables. So I assume there is logic on the server side that does this.