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

Reduce wakeups by tpool maintenance timer, when server is idle

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Fixed
    • 10.5
    • 10.5.9
    • Server
    • None

    Description

      monty 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

        Issue Links

          Activity

            Shelnutt2 Seth Shelnutt added a comment - - edited

            We are seeing an error with our OSX testing from this change still. I know a few fixes went in around this commit but there still seems to be a minor problem.

            Error:

            /Users/runner/work/1/s/10.5/tpool/tpool_generic.cc:572:6: error: constexpr variable cannot have non-literal type 'const std::__1::chrono::time_point<std::__1::chrono::system_clock, std::__1::chrono::duration<long long, std::__1::ratio<1, 1000000> > >'
            auto invalid_timestamp=  std::chrono::system_clock::time_point::max();
            

            Full build log:
            https://dev.azure.com/TileDB-Inc/CI/_build/results?buildId=7791&view=logs&j=f4ee9066-1821-5d26-c193-d558ffef2269&t=db128dfa-18a1-5b21-9fe0-ac1172e703e3

            cmake command:

            cmake -DPLUGIN_TOKUDB=NO -DPLUGIN_ROCKSDB=NO -DPLUGIN_MROONGA=NO -DPLUGIN_SPIDER=NO -DPLUGIN_SPHINX=NO -DPLUGIN_FEDERATED=NO -DPLUGIN_FEDERATEDX=NO -DPLUGIN_CONNECT=NO -DCMAKE_BUILD_TYPE=Debug -SWITH_DEBUG=1 ..
            

            Shelnutt2 Seth Shelnutt added a comment - - edited We are seeing an error with our OSX testing from this change still. I know a few fixes went in around this commit but there still seems to be a minor problem. Error: /Users/runner/work/1/s/10.5/tpool/tpool_generic.cc:572:6: error: constexpr variable cannot have non-literal type 'const std::__1::chrono::time_point<std::__1::chrono::system_clock, std::__1::chrono::duration<long long, std::__1::ratio<1, 1000000> > >' auto invalid_timestamp= std::chrono::system_clock::time_point::max(); Full build log: https://dev.azure.com/TileDB-Inc/CI/_build/results?buildId=7791&view=logs&j=f4ee9066-1821-5d26-c193-d558ffef2269&t=db128dfa-18a1-5b21-9fe0-ac1172e703e3 cmake command: cmake -DPLUGIN_TOKUDB=NO -DPLUGIN_ROCKSDB=NO -DPLUGIN_MROONGA=NO -DPLUGIN_SPIDER=NO -DPLUGIN_SPHINX=NO -DPLUGIN_FEDERATED=NO -DPLUGIN_FEDERATEDX=NO -DPLUGIN_CONNECT=NO -DCMAKE_BUILD_TYPE=Debug -SWITH_DEBUG=1 ..

            Shelnutt2, I think that I saw a similar error when compiling with clang++-11 on GNU/Linux, but only when using cmake -DWITH_MSAN. Would the replacement of constexpr with static const work for you?

            marko Marko Mäkelä added a comment - Shelnutt2 , I think that I saw a similar error when compiling with clang++-11 on GNU/Linux, but only when using cmake -DWITH_MSAN . Would the replacement of constexpr with static const work for you?

            People

              wlad Vladislav Vaintroub
              wlad Vladislav Vaintroub
              Votes:
              0 Vote for this issue
              Watchers:
              4 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.