<div id="docs-body">
 <div class="section">
  <div class="titlepage">
   <div>
    <div>
     <h2 class="title">
      <a name="faqs-thread-pool">
      </a>
      A.15 MySQL 8.4 FAQ: MySQL Enterprise Thread Pool
     </h2>
    </div>
   </div>
  </div>
  <div class="qandaset">
   <a name="idm46045054932928">
   </a>
   <dl>
    <dt>
     A.15.1.
     <a href="faqs-thread-pool.html#faq-thread-pool-what-solve">
      What is the Thread Pool and what problem does it solve?
     </a>
    </dt>
    <dt>
     A.15.2.
     <a href="faqs-thread-pool.html#faq-thread-pool-how-manage-operation">
      How does the Thread Pool limit and manage concurrent sessions
        and transactions for optimal performance and throughput?
     </a>
    </dt>
    <dt>
     A.15.3.
     <a href="faqs-thread-pool.html#faq-thread-pool-how-diff-connector-pool">
      How is the Thread Pool different from the client side Connection
        Pool?
     </a>
    </dt>
    <dt>
     A.15.4.
     <a href="faqs-thread-pool.html#faq-thread-pool-when-use">
      When should I use the Thread Pool?
     </a>
    </dt>
    <dt>
     A.15.5.
     <a href="faqs-thread-pool.html#faq-thread-pool-what-config-recommend">
      Are there recommended Thread Pool configurations?
     </a>
    </dt>
   </dl>
   <table border="0" style="width: 100%;">
    <colgroup>
     <col align="left" width="1%"/>
     <col/>
    </colgroup>
    <tbody>
     <tr class="question">
      <td align="left" valign="top">
       <a name="faq-thread-pool-what-solve">
       </a>
       <a name="idm46045054932160">
       </a>
       <p>
        <b>
         A.15.1.
        </b>
       </p>
      </td>
      <td align="left" valign="top">
       <p>
        What is the Thread Pool and what problem does it solve?
       </p>
      </td>
     </tr>
     <tr class="answer">
      <td align="left" valign="top">
      </td>
      <td align="left" valign="top">
       <p>
        The MySQL Thread Pool is a MySQL server plugin that extends the
        default connection-handling capabilities of the MySQL server to
        limit the number of concurrently executing statements/queries
        and transactions to ensure that each has sufficient CPU and
        memory resources to fulfill its task. For MySQL
        8.4, the Thread Pool plugin is included in MySQL Enterprise Edition, a
        commercial product.
       </p>
       <p>
        The default thread-handling model in MySQL Server executes
        statements using one thread per client connection. As more
        clients connect to the server and execute statements, overall
        performance degrades. The Thread Pool plugin provides an
        alternative thread-handling model designed to reduce overhead
        and improve performance. The Thread Pool plugin increases server
        performance by efficiently managing statement execution threads
        for large numbers of client connections, especially on modern
        multi-CPU/Core systems.
       </p>
       <p>
        For more information, see
        <a class="xref" href="thread-pool.html" title="7.6.3 MySQL Enterprise Thread Pool">
         Section 7.6.3, “MySQL Enterprise Thread Pool”
        </a>
        .
       </p>
      </td>
     </tr>
     <tr class="question">
      <td align="left" valign="top">
       <a name="faq-thread-pool-how-manage-operation">
       </a>
       <a name="idm46045054927696">
       </a>
       <p>
        <b>
         A.15.2.
        </b>
       </p>
      </td>
      <td align="left" valign="top">
       <p>
        How does the Thread Pool limit and manage concurrent sessions
        and transactions for optimal performance and throughput?
       </p>
      </td>
     </tr>
     <tr class="answer">
      <td align="left" valign="top">
      </td>
      <td align="left" valign="top">
       <p>
        The Thread Pool uses a
        <span class="quote">
         “
         <span class="quote">
          divide and conquer
         </span>
         ”
        </span>
        approach to limiting and balancing concurrency. Unlike the
        default connection handling of the MySQL Server, the Thread Pool
        separates connections and threads, so there is no fixed
        relationship between connections and the threads that execute
        statements received from those connections. The Thread Pool then
        manages client connections within configurable thread groups,
        where they are prioritized and queued based on the nature of the
        work they were submitted to accomplish.
       </p>
       <p>
        For more information, see
        <a class="xref" href="thread-pool-operation.html" title="7.6.3.3 Thread Pool Operation">
         Section 7.6.3.3, “Thread Pool Operation”
        </a>
        .
       </p>
      </td>
     </tr>
     <tr class="question">
      <td align="left" valign="top">
       <a name="faq-thread-pool-how-diff-connector-pool">
       </a>
       <a name="idm46045054923536">
       </a>
       <p>
        <b>
         A.15.3.
        </b>
       </p>
      </td>
      <td align="left" valign="top">
       <p>
        How is the Thread Pool different from the client side Connection
        Pool?
       </p>
      </td>
     </tr>
     <tr class="answer">
      <td align="left" valign="top">
      </td>
      <td align="left" valign="top">
       <p>
        The MySQL Connection Pool operates on the client side to ensure
        that a MySQL client does not constantly connect to and
        disconnect from the MySQL server. It is designed to cache idle
        connections in the MySQL client for use by other users as they
        are needed. This minimizes the overhead and expense of
        establishing and tearing down connections as queries are
        submitted to the MySQL server. The MySQL Connection Pool has no
        visibility as to the query handling capabilities or load of the
        back-end MySQL server. By contrast, the Thread Pool operates on
        the MySQL server side and is designed to manage the execution of
        inbound concurrent connections and queries as they are received
        from the client connections accessing the back-end MySQL
        database. Because of the separation of duties, the MySQL
        Connection Pool and Thread Pool are orthogonal and can be used
        independent of each other.
       </p>
       <p>
        MySQL Connection Pooling via the MySQL Connectors is covered in
        <a class="xref" href="connectors-apis.html" title="Chapter 31 Connectors and APIs">
         Chapter 31,
         <i>
          Connectors and APIs
         </i>
        </a>
        .
       </p>
      </td>
     </tr>
     <tr class="question">
      <td align="left" valign="top">
       <a name="faq-thread-pool-when-use">
       </a>
       <a name="idm46045054919392">
       </a>
       <p>
        <b>
         A.15.4.
        </b>
       </p>
      </td>
      <td align="left" valign="top">
       <p>
        When should I use the Thread Pool?
       </p>
      </td>
     </tr>
     <tr class="answer">
      <td align="left" valign="top">
      </td>
      <td align="left" valign="top">
       <p>
        There are a few rules of thumb to consider for optimal Thread
        Pool use cases:
       </p>
       <p>
        The MySQL
        <a class="link" href="server-status-variables.html#statvar_Threads_running">
         <code class="literal">
          Threads_running
         </code>
        </a>
        variable keeps track of the number of concurrent statements
        currently executing in the MySQL Server. If this variable
        consistently exceeds a region where the server won't operate
        optimally (usually going beyond 40 for InnoDB workloads), the
        Thread Pool should be beneficial, especially in extreme parallel
        overload situations.
       </p>
       <p>
        If you are using the
        <a class="link" href="innodb-parameters.html#sysvar_innodb_thread_concurrency">
         <code class="literal">
          innodb_thread_concurrency
         </code>
        </a>
        to
        limit the number of concurrently executing statements, you
        should find that the Thread Pool solves the same problem, only
        better, by assigning connections to thread groups, then queuing
        executions based on transactional content, user defined
        designations, and so forth.
       </p>
       <p>
        Lastly, if your workload comprises mainly short queries, the
        Thread Pool should be beneficial.
       </p>
       <p>
        To learn more, see
        <a class="xref" href="thread-pool-tuning.html" title="7.6.3.4 Thread Pool Tuning">
         Section 7.6.3.4, “Thread Pool Tuning”
        </a>
        .
       </p>
      </td>
     </tr>
     <tr class="question">
      <td align="left" valign="top">
       <a name="faq-thread-pool-what-config-recommend">
       </a>
       <a name="idm46045054911648">
       </a>
       <p>
        <b>
         A.15.5.
        </b>
       </p>
      </td>
      <td align="left" valign="top">
       <p>
        Are there recommended Thread Pool configurations?
       </p>
      </td>
     </tr>
     <tr class="answer">
      <td align="left" valign="top">
      </td>
      <td align="left" valign="top">
       <p>
        The Thread Pool has a number of user case driven configuration
        parameters that affect its performance. To learn about these and
        tips on tuning, see
        <a class="xref" href="thread-pool-tuning.html" title="7.6.3.4 Thread Pool Tuning">
         Section 7.6.3.4, “Thread Pool Tuning”
        </a>
        .
       </p>
      </td>
     </tr>
    </tbody>
   </table>
  </div>
 </div>
 <br/>
</div>
