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

Reduce wakeups by tpool maintenance timer, when server is idle

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 10.5
    • Fix Version/s: 10.5.9
    • Component/s: Server
    • Labels:
      None

      Description

      Michael Widenius notes that idle server still wakes up now and then. While most of the wakeups can be attrbiuted to Innodb's periodic timers, there is a single timer which is mostly there to prevent deadlocks, the "maintenance" timer. It currently wakes up every 0.4 second to check if a thread needs to be created or an idle thread needs to be woken. It is there to prevent "stalls".

      When the database is idle, and stalls are not foreseen in the near future, this timer could be switched off. Due to technical reasons (the underlying mysys timer likes to deadlock for anything else that trivial use), switching off and on is not possible, but there is a workaround that allows to change the timer period (unfortunately, not the next "deadline") for periodic timers, without LOCK_timer lock.

      Note that since changing next deadline when timer fires won't be possible,as explained above,
      we can only do a slightly longer timeout to emulate "off", e.g 5 seconds or somesuch. It is still 10x less wakeups.

      The timer needs to be switched back on, when there is throttling in thread creation, as otherwise deadlocks are possible, and maybe in some other scenarios

        Attachments

          Activity

            People

            Assignee:
            wlad Vladislav Vaintroub
            Reporter:
            wlad Vladislav Vaintroub
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: