Skip to content

cas_event_mutex has contention for random seed #90

@jty2

Description

@jty2

In [1] and [2], it was identified that the ut_rnd_ulint_counter global variable is updated by every thread for a random backoff spinlock, "leading to cache coherency and performance degradation" under heavy mutex contention. A patch to make the variable thread-local first appeared in mysql-5.7.14, but was then reverted [3], even though the MySQL 5.7.15 Release Notes indicated it as fixed [4]. The patch remained reverted for the rest of the mysql-5.7 series, even in the final 5.7.44 release [5]. The patch finally appeared without reversion in mysql-8.0.0 [6].

Although a fix was implemented, it remained reverted, so this is a performance issue representative of the entire mysql-5.7.x series. Lockhammer portrays the software from external projects as-is, so this will not be fixed except through a whole refresh of code from a newer release of MySQL.

References:

[1] Bug #22733635 CACHE LINE CONTENTION ON UT_RND_ULINT_COUNTER
mysql/mysql-server@32b184c

[2] Cache line contention on ut_rnd_ulint_counter
https://bugs.mysql.com/bug.php?id=80354

[3] Revert "Bug #22733635 CACHE LINE CONTENTION ON UT_RND_ULINT_COUNTER"
mysql/mysql-server@1f906de

[4] Changes in MySQL 5.7.15 (2016-09-06, General Availability)
https://dev.mysql.com/doc/relnotes/mysql/5.7/en/news-5-7-15.html

InnoDB: A global counter (ut_rnd_ulint_counter) was changed to a thread-local counter to make it scalable on multi-core systems. (Bug #22733635, Bug #80354)

[5]
https://github.com/mysql/mysql-server/blame/mysql-5.7.44/storage/innobase/include/ut0rnd.ic

[6]
https://github.com/mysql/mysql-server/blame/mysql-8.0.0/storage/innobase/include/ut0rnd.ic

Metadata

Metadata

Assignees

No one assigned

    Labels

    wontfixThis will not be worked on

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions