Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-15135

'show global status' can cause lock contention on LOCK_thread_count

Details

    Description

      calc_sum_of_all_status() holds the LOCK_thread_count mutex for the whole duration of its calculations, which can take a while when having many active connections, so blocking other threads waiting on the same mutex.

      In MySQL 5.7 this is fixed by taking copies of relevant THD object data first (while holding the LOCK_thread_count), and only then doing the actual calculations after releasing the mutex again.

      See MySQL bug #42930 and changeset 034c40f4baeff1a1d2dd637f6a1f2c2720a4d26f

      https://bugs.mysql.com/bug.php?id=42930

      https://github.com/mysql/mysql-server/commit/034c40f4baeff1a1d2dd637f6a1f2c2720a4d26f

      Attachments

        Issue Links

          Activity

            wlad Vladislav Vaintroub added a comment - - edited

            ralf.gebhardt@mariadb.com, you can assign that to me, if you don't mind. To get an estimate, some experimentation (with different ideas listed there) might be necessary.

            wlad Vladislav Vaintroub added a comment - - edited ralf.gebhardt@mariadb.com , you can assign that to me, if you don't mind. To get an estimate, some experimentation (with different ideas listed there) might be necessary.
            ralf.gebhardt Ralf Gebhardt added a comment - - edited

            wlad done, thanks! serg It is not completely clear to me how this task and MDEV-17251 are related. Are both needed?

            ralf.gebhardt Ralf Gebhardt added a comment - - edited wlad done, thanks! serg It is not completely clear to me how this task and MDEV-17251 are related. Are both needed?

            I think yes. MDEV-17251 is about not doing an expensive piece of work, when it's not needed at all. This issue is about reducing mutex contention during this "expensive piece of work" (when it still has to be done).

            serg Sergei Golubchik added a comment - I think yes. MDEV-17251 is about not doing an expensive piece of work, when it's not needed at all. This issue is about reducing mutex contention during this "expensive piece of work" (when it still has to be done).
            wlad Vladislav Vaintroub added a comment - - edited

            It is related, though not completely overlapping. the one is about contention (which can be solved even with making mutex an rwlock), so there is no contention. The MDEV-17251 another one is about making an expensive operation cheaper, in some cases, but not universally applicable. This can reduce contention (in some cases, not universally), if we do not do anything with the mutex

            wlad Vladislav Vaintroub added a comment - - edited It is related, though not completely overlapping. the one is about contention (which can be solved even with making mutex an rwlock), so there is no contention. The MDEV-17251 another one is about making an expensive operation cheaper, in some cases, but not universally applicable. This can reduce contention (in some cases, not universally), if we do not do anything with the mutex

            Benchmark description : mysqlslap -uroot --query="show global status" --create-schema=mysql --concurrency=50 --verbose --iterations=3 --number-of-queries=100000

            wlad Vladislav Vaintroub added a comment - Benchmark description : mysqlslap -uroot --query="show global status" --create-schema=mysql --concurrency=50 --verbose --iterations=3 --number-of-queries=100000

            People

              wlad Vladislav Vaintroub
              hholzgra Hartmut Holzgraefe
              Votes:
              3 Vote for this issue
              Watchers:
              10 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.