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

fix innodb-adaptive-hash-index scalability with multiple threads

Details

    Description

      InnoDB adaptive indexes has performance problems when running queries in parallel that uses InnoDB hash indexes (at least on the same tables).

      Here is an example of running the same SELECT query with 10-256 concurrent threads.
      (The query normally takes about 0.36 seconds):

      Total execution with 10 threads time: 1 seconds
      Total execution with 32 threads time: 1 seconds
      Total execution with 64 threads time: 3 seconds
      Total execution with 128 threads time: 5 seconds
      Total execution with 256 threads time: 9 seconds

      When using --innodb-adaptive-hash-index=1 we get:

      Total execution with 10 threads time: 1 seconds
      Total execution with 32 threads time: 5 seconds
      Total execution with 64 threads time: 9 seconds
      Total execution with 128 threads time: 18 seconds
      Total execution with 256 threads time: 50 seconds

      MySQL 5.7 does not have this issue. It has roughly the same speed with and without the hash indexes.

      In the above query, there was a driving table with a 400 rows doing lookups in a child table using 200 lookups on a secondary keys for every row from the driving table.
      Using innodb-adaptive-hash-index=1 speeds up the query with 37% when running a query in one thread but it slows down drastically when running 32-256 concurrent threads.

      Attachments

        Issue Links

          Activity

            monty Michael Widenius created issue -
            serg Sergei Golubchik made changes -
            Field Original Value New Value
            Summary innodb-adaptive-hash-index does not scale with multiple threads fix innodb-adaptive-hash-index scalability with multiple threads
            monty Michael Widenius made changes -
            Description InnoDB adaptive indexes has performance problems when running queries in parallel that uses InnoDB hash indexes (at least on the same tables).

            Here is an example of running the same SELECT query with 10-256 concurrent threads.
            (The query normally takes about 0.36 seconds):

            Total execution with 10 threads time: 1 seconds
            Total execution with 32 threads time: 1 seconds
            Total execution with 64 threads time: 3 seconds
            Total execution with 128 threads time: 5 seconds
            Total execution with 256 threads time: 9 seconds

            When using --innodb-adaptive-hash-index=1 we get:

            Total execution with 10 threads time: 1 seconds
            Total execution with 32 threads time: 5 seconds
            Total execution with 64 threads time: 9 seconds
            Total execution with 128 threads time: 18 seconds
            Total execution with 256 threads time: 50 seconds

            MySQL 5.7 does not have this issue. It has roughly the same speed with and without the hash indexes.

            In the above query, there was a driving table with a 400 rows doing lookups in a child table using 200 lookups on a secondary keys for every row from the driving table.
            Using innodb-adaptive-hash-index=1 speeds up the query with 37% when running a query in one thread but it slows down drastically when running 256 concurrent threads.

            InnoDB adaptive indexes has performance problems when running queries in parallel that uses InnoDB hash indexes (at least on the same tables).

            Here is an example of running the same SELECT query with 10-256 concurrent threads.
            (The query normally takes about 0.36 seconds):

            Total execution with 10 threads time: 1 seconds
            Total execution with 32 threads time: 1 seconds
            Total execution with 64 threads time: 3 seconds
            Total execution with 128 threads time: 5 seconds
            Total execution with 256 threads time: 9 seconds

            When using --innodb-adaptive-hash-index=1 we get:

            Total execution with 10 threads time: 1 seconds
            Total execution with 32 threads time: 5 seconds
            Total execution with 64 threads time: 9 seconds
            Total execution with 128 threads time: 18 seconds
            Total execution with 256 threads time: 50 seconds

            MySQL 5.7 does not have this issue. It has roughly the same speed with and without the hash indexes.

            In the above query, there was a driving table with a 400 rows doing lookups in a child table using 200 lookups on a secondary keys for every row from the driving table.
            Using innodb-adaptive-hash-index=1 speeds up the query with 37% when running a query in one thread but it slows down drastically when running 32-256 concurrent threads.

            monty Michael Widenius made changes -
            Assignee Marko Mäkelä [ marko ]
            monty Michael Widenius made changes -
            Attachment innodb-hashtest.sh [ 74086 ]
            marko Marko Mäkelä made changes -
            Status Open [ 1 ] In Progress [ 3 ]
            marko Marko Mäkelä made changes -
            Fix Version/s 10.5 [ 23123 ]
            Fix Version/s 10.6 [ 24028 ]
            Fix Version/s 10.11 [ 27614 ]
            Fix Version/s 10.6.11 [ 28441 ]
            marko Marko Mäkelä made changes -
            marko Marko Mäkelä made changes -
            Status In Progress [ 3 ] In Testing [ 10301 ]
            marko Marko Mäkelä made changes -
            Assignee Marko Mäkelä [ marko ] Michael Widenius [ monty ]
            marko Marko Mäkelä made changes -
            Assignee Michael Widenius [ monty ] Marko Mäkelä [ marko ]
            Status In Testing [ 10301 ] Stalled [ 10000 ]
            marko Marko Mäkelä made changes -
            Status Stalled [ 10000 ] In Progress [ 3 ]
            marko Marko Mäkelä made changes -
            marko Marko Mäkelä made changes -
            marko Marko Mäkelä made changes -
            marko Marko Mäkelä made changes -
            marko Marko Mäkelä made changes -
            marko Marko Mäkelä made changes -
            marko Marko Mäkelä made changes -
            marko Marko Mäkelä made changes -
            Assignee Marko Mäkelä [ marko ] Vladislav Lesin [ vlad.lesin ]
            Status In Progress [ 3 ] In Review [ 10002 ]
            marko Marko Mäkelä made changes -
            Attachment ahi.sh [ 74245 ]
            ralf.gebhardt Ralf Gebhardt made changes -
            Fix Version/s 11.8 [ 29921 ]
            Fix Version/s 10.5 [ 23123 ]
            Fix Version/s 10.6 [ 24028 ]
            Fix Version/s 10.11 [ 27614 ]
            rob.schwyzer@mariadb.com Rob Schwyzer (Inactive) made changes -
            rob.schwyzer@mariadb.com Rob Schwyzer (Inactive) made changes -
            ralf.gebhardt Ralf Gebhardt made changes -
            Labels tech_debt
            marko Marko Mäkelä made changes -
            vlad.lesin Vladislav Lesin made changes -
            Assignee Vladislav Lesin [ vlad.lesin ] Marko Mäkelä [ marko ]
            Status In Review [ 10002 ] Stalled [ 10000 ]
            marko Marko Mäkelä made changes -
            Status Stalled [ 10000 ] In Testing [ 10301 ]
            marko Marko Mäkelä made changes -
            Assignee Marko Mäkelä [ marko ] Matthias Leich [ mleich ]
            rob.schwyzer@mariadb.com Rob Schwyzer (Inactive) made changes -
            rob.schwyzer@mariadb.com Rob Schwyzer (Inactive) made changes -
            rob.schwyzer@mariadb.com Rob Schwyzer (Inactive) made changes -
            serg Sergei Golubchik made changes -
            serg Sergei Golubchik made changes -
            rob.schwyzer@mariadb.com Rob Schwyzer (Inactive) made changes -
            mleich Matthias Leich made changes -
            Assignee Matthias Leich [ mleich ] Marko Mäkelä [ marko ]
            Status In Testing [ 10301 ] Stalled [ 10000 ]
            rob.schwyzer@mariadb.com Rob Schwyzer (Inactive) made changes -
            serg Sergei Golubchik made changes -
            Status Stalled [ 10000 ] In Testing [ 10301 ]
            serg Sergei Golubchik made changes -
            Assignee Marko Mäkelä [ marko ] Matthias Leich [ mleich ]
            mleich Matthias Leich made changes -
            Assignee Matthias Leich [ mleich ] Marko Mäkelä [ marko ]
            Status In Testing [ 10301 ] Stalled [ 10000 ]
            marko Marko Mäkelä made changes -
            issue.field.resolutiondate 2025-01-10 15:58:44.0 2025-01-10 15:58:43.663
            marko Marko Mäkelä made changes -
            Fix Version/s 11.8.1 [ 29961 ]
            Fix Version/s 11.8 [ 29921 ]
            Resolution Fixed [ 1 ]
            Status Stalled [ 10000 ] Closed [ 6 ]
            rob.schwyzer@mariadb.com Rob Schwyzer (Inactive) made changes -
            rob.schwyzer@mariadb.com Rob Schwyzer (Inactive) made changes -
            rob.schwyzer@mariadb.com Rob Schwyzer (Inactive) made changes -
            ralf.gebhardt Ralf Gebhardt made changes -
            Labels tech_debt Preview_11.8 tech_debt
            rob.schwyzer@mariadb.com Rob Schwyzer (Inactive) made changes -
            serg Sergei Golubchik made changes -
            Issue Type Task [ 3 ] New Feature [ 2 ]
            rob.schwyzer@mariadb.com Rob Schwyzer (Inactive) made changes -
            rob.schwyzer@mariadb.com Rob Schwyzer (Inactive) made changes -
            rob.schwyzer@mariadb.com Rob Schwyzer (Inactive) made changes -
            kyle.hutchinson Kyle Hutchinson made changes -

            People

              marko Marko Mäkelä
              monty Michael Widenius
              Votes:
              1 Vote for this issue
              Watchers:
              15 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.