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

Status threads_running show wrong value since 10.3

Details

    Description

      SHOW GLOBAL STATUS LIKE 'threads_running' was a good indicator for the current running workload in a database.

      Sine MariaDB 10.3 it is showing higher values than before (MariaDB 10.2 and lower and competitive products).

      10.2.14-MariaDB-log MariaDB Server

      SELECT id, user, command, state FROM information_schema.processlist;
      +----+-------------+-------------+------------------------------------------------------------------+
      | id | user        | command     | state                                                            |
      +----+-------------+-------------+------------------------------------------------------------------+
      | 21 | root        | Query       | Filling schema table                                             |
      | 10 | replication | Binlog Dump | Master has sent all binlog to slave; waiting for binlog to be up |
      |  5 | system user | Daemon      | InnoDB shutdown handler                                          |
      |  4 | system user | Daemon      | InnoDB purge worker                                              |
      |  2 | system user | Daemon      | InnoDB purge worker                                              |
      |  1 | system user | Daemon      | InnoDB purge worker                                              |
      |  3 | system user | Daemon      | InnoDB purge coordinator                                         |
      +----+-------------+-------------+------------------------------------------------------------------+
      7 rows in set (0.00 sec)
      

      SHOW GLOBAL STATUS LIKE 'threads_running';
      +-----------------+-------+
      | Variable_name   | Value |
      +-----------------+-------+
      | Threads_running | 2     |
      +-----------------+-------+
      

      10.3.12-MariaDB-log MariaDB Server

      SELECT id, user, command, state FROM information_schema.processlist;
      +----+-------------+---------+--------------------------+
      | id | user        | command | state                    |
      +----+-------------+---------+--------------------------+
      | 10 | root        | Query   | Filling schema table     |
      |  5 | system user | Daemon  | InnoDB shutdown handler  |
      |  2 | system user | Daemon  | InnoDB purge coordinator |
      |  4 | system user | Daemon  | InnoDB purge worker      |
      |  3 | system user | Daemon  | InnoDB purge worker      |
      |  1 | system user | Daemon  | InnoDB purge worker      |
      +----+-------------+---------+--------------------------+
      6 rows in set (0.001 sec)
      

      SHOW GLOBAL STATUS LIKE 'threads_running';
      +-----------------+-------+
      | Variable_name   | Value |
      +-----------------+-------+
      | Threads_running | 6     |
      +-----------------+-------+
      

      It seems like now it is showing all Threads from Processlist including Daemon threads. This was not the case before. The Daemon threads are currently not doing anything on my system so they should not be counted in.

      Impact: This could influence/confuse all monitoring solutions for MariaDB and will show a virtual higher workload compared to previous versions (bad image) and pseudo-require more CPU resource allocation for newer releases.

      Possibly was introduced with this fix: https://jira.mariadb.org/browse/MDEV-14505

      Attachments

        Issue Links

          Activity

            It was indeed done in the scope of MDEV-14505, and technically it works as documented:

            all threads having a command not equal to COM_SLEEP are included

            I'll leave it to svoj to further comment on it.

            elenst Elena Stepanova added a comment - It was indeed done in the scope of MDEV-14505 , and technically it works as documented : all threads having a command not equal to COM_SLEEP are included I'll leave it to svoj to further comment on it.

            I thought about this tonight as well an I came to a similar conclusion. So possibly the problem is not threads_running but that daemon threads should be in command COM_SLEEP when they are not active. This would also make the value of threads_running better to estimate system load from the database point of view. So threads_runnings was showing the wrong number all the time up to now.

            And I realise again I should read more documentation and not remember how it was earlier...

            oli Oli Sennhauser added a comment - I thought about this tonight as well an I came to a similar conclusion. So possibly the problem is not threads_running but that daemon threads should be in command COM_SLEEP when they are not active. This would also make the value of threads_running better to estimate system load from the database point of view. So threads_runnings was showing the wrong number all the time up to now. And I realise again I should read more documentation and not remember how it was earlier...

            If disregarding sleeping background threads works, it should be relatively easy to implement.

            svoj Sergey Vojtovich added a comment - If disregarding sleeping background threads works, it should be relatively easy to implement.

            Must've been fixed in 10.5 by MDEV-16264.

            svoj Sergey Vojtovich added a comment - Must've been fixed in 10.5 by MDEV-16264 .

            People

              svoj Sergey Vojtovich
              oli Oli Sennhauser
              Votes:
              0 Vote for this issue
              Watchers:
              5 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.