<div id="docs-body">
 <div class="section">
  <div class="titlepage">
   <div>
    <div>
     <h3 class="title">
      <a name="mysql-gr-memory-monitoring-ps-instruments">
      </a>
      20.7.9 Monitoring Group Replication Memory Usage with Performance Schema Memory
Instrumentation
     </h3>
    </div>
   </div>
  </div>
  <div class="toc">
   <dl class="toc">
    <dt>
     <span class="section">
      <a href="mysql-gr-memory-monitoring-ps-instruments-enable.html">
       20.7.9.1 Enabling or Disabling Group Replication Instrumentation
      </a>
     </span>
    </dt>
    <dt>
     <span class="section">
      <a href="mysql-gr-memory-monitoring-ps-sample-queries.html">
       20.7.9.2 Example Queries
      </a>
     </span>
    </dt>
   </dl>
  </div>
  <a class="indexterm" name="idm46045131808416">
  </a>
  <p>
   The MySQL
   <a class="link" href="performance-schema.html" title="Chapter 29 MySQL Performance Schema">
    Performance
      Schema
   </a>
   provides instrumentation for performance monitoring
      of Group Replication memory usage. To view the available Group
      Replication instrumentation, issue the following query:
  </p>
  <div class="copytoclipboard-wrapper">
   <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa60181795"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql&gt;</span> <span class="token keyword">SELECT</span> <span class="token keyword">NAME</span><span class="token punctuation">,</span>ENABLED <span class="token keyword">FROM</span> performance_schema<span class="token punctuation">.</span>setup_instruments
       <span class="token keyword">WHERE</span> <span class="token keyword">NAME</span> <span class="token operator">LIKE</span> <span class="token string">'memory/group_rpl/%'</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> NAME                                                              <span class="token punctuation">|</span> ENABLED <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> memory/group_rpl/write_set_encoded                                <span class="token punctuation">|</span> YES     <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> memory/group_rpl/certification_data                               <span class="token punctuation">|</span> YES     <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> memory/group_rpl/certification_data_gc                            <span class="token punctuation">|</span> YES     <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> memory/group_rpl/certification_info                               <span class="token punctuation">|</span> YES     <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> memory/group_rpl/transaction_data                                 <span class="token punctuation">|</span> YES     <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> memory/group_rpl/sql_service_command_data                         <span class="token punctuation">|</span> YES     <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> memory/group_rpl/mysql_thread_queued_task                         <span class="token punctuation">|</span> YES     <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> memory/group_rpl/message_service_queue                            <span class="token punctuation">|</span> YES     <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> memory/group_rpl/message_service_received_message                 <span class="token punctuation">|</span> YES     <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> memory/group_rpl/group_member_info                                <span class="token punctuation">|</span> YES     <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> memory/group_rpl/consistent_members_that_must_prepare_transaction <span class="token punctuation">|</span> YES     <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> memory/group_rpl/consistent_transactions                          <span class="token punctuation">|</span> YES     <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> memory/group_rpl/consistent_transactions_prepared                 <span class="token punctuation">|</span> YES     <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> memory/group_rpl/consistent_transactions_waiting                  <span class="token punctuation">|</span> YES     <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> memory/group_rpl/consistent_transactions_delayed_view_change      <span class="token punctuation">|</span> YES     <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> memory/group_rpl/GCS_XCom::xcom_cache                             <span class="token punctuation">|</span> YES     <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> memory/group_rpl/Gcs_message_data::m_buffer                       <span class="token punctuation">|</span> YES     <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span></code></pre>
  </div>
  <p>
   For more information on Performance Schema's memory
      instrumentation and events, see
   <a class="xref" href="performance-schema-memory-summary-tables.html" title="29.12.20.10 Memory Summary Tables">
    Section 29.12.20.10, “Memory Summary Tables”
   </a>
   .
  </p>
  <h4>
   <a name="idm46045131800176">
   </a>
   Performance Schema Group Replication instruments memory allocation for
Group Replication.
  </h4>
  <p>
   The
   <code class="literal">
    memory/group_rpl/
   </code>
   Performance Schema
      instrumentation contains the following instruments:
  </p>
  <div class="itemizedlist">
   <ul class="itemizedlist" style="list-style-type: disc; ">
    <li class="listitem">
     <p>
      <code class="literal">
       write_set_encoded
      </code>
      : Memory allocated to
          encode the write set before it is broadcast to the group
          members.
     </p>
    </li>
    <li class="listitem">
     <p>
      <code class="literal">
       Gcs_message_data::m_buffer
      </code>
      : Memory
          allocated for the transaction data payload sent to the
          network.
     </p>
    </li>
    <li class="listitem">
     <p>
      <code class="literal">
       certification_data
      </code>
      : Memory allocated for
          certification of incoming transactions.
     </p>
    </li>
    <li class="listitem">
     <p>
      <code class="literal">
       certification_data_gc
      </code>
      : Memory allocated for
          the GTID_EXECUTED sent by each member for garbage collection.
     </p>
    </li>
    <li class="listitem">
     <p>
      <code class="literal">
       certification_info
      </code>
      : Memory allocated for
          storage of certification information allocated to resolve
          conflicts between concurrent transactions.
     </p>
    </li>
    <li class="listitem">
     <p>
      <code class="literal">
       transaction_data
      </code>
      : Memory allocated for
          incoming transactions queued for the plugin pipeline.
     </p>
    </li>
    <li class="listitem">
     <p>
      <code class="literal">
       message_service_received_message
      </code>
      : Memory
          allocated to receiving messages from Group Replication
          delivery message service.
     </p>
    </li>
    <li class="listitem">
     <p>
      <code class="literal">
       sql_service_command_data
      </code>
      : Memory allocated
          for processing the queue of internal SQL service commands.
     </p>
    </li>
    <li class="listitem">
     <p>
      <code class="literal">
       mysql_thread_queued_task
      </code>
      : Memory allocated
          when a MySQL-thread dependent task is added to the processing
          queue.
     </p>
    </li>
    <li class="listitem">
     <p>
      <code class="literal">
       message_service_queue
      </code>
      : Memory allocated for
          queued messages of the Group Replication delivery message
          service.
     </p>
    </li>
    <li class="listitem">
     <p>
      <code class="literal">
       GCS_XCom::xcom_cache
      </code>
      : Memory allocated to
          XCOM ache for messaging and metadata exchanged between group
          members as part of the consensus protocol.
     </p>
    </li>
    <li class="listitem">
     <p>
      <code class="literal">
       consistent_members_that_must_prepare_transaction
      </code>
      :
          Memory allocated to hold list of members preparing transaction
          for Group Replication transaction consistency guarantees.
     </p>
    </li>
    <li class="listitem">
     <p>
      <code class="literal">
       consistent_transactions
      </code>
      : Memory allocated
          to hold transaction and list of members that must prepare that
          transaction for Group Replication transaction consistency
          guarantees.
     </p>
    </li>
    <li class="listitem">
     <p>
      <code class="literal">
       consistent_transactions_prepared
      </code>
      : Memory
          allocated to hold list of transaction's info prepared for the
          Group Replication Transaction Consistency Guarantees.
     </p>
    </li>
    <li class="listitem">
     <p>
      <code class="literal">
       consistent_transactions_waiting
      </code>
      : Memory
          allocated to hold information on a list of transactions while
          preceding prepared transactions with consistency of
      <code class="literal">
       AFTER
      </code>
      and
      <code class="literal">
       BEFORE_AND_AFTER
      </code>
      are processed.
     </p>
    </li>
    <li class="listitem">
     <p>
      <code class="literal">
       consistent_transactions_delayed_view_change
      </code>
      :
          Memory allocated to hold list of view change events
          (
      <code class="literal">
       view_change_log_event
      </code>
      ) delayed by prepared
          consistent transactions waiting for prepare acknowledgement.
     </p>
    </li>
    <li class="listitem">
     <p>
      <code class="literal">
       group_member_info
      </code>
      : Memory allocated to hold
          the group member properties. Properties such as hostname,
          port, member weight and role, and so on.
     </p>
    </li>
   </ul>
  </div>
  <p>
   The following instruments in the
   <code class="literal">
    memory/sql/
   </code>
   grouping are also used to monitor Group Replication memory:
  </p>
  <div class="itemizedlist">
   <ul class="itemizedlist" style="list-style-type: disc; ">
    <li class="listitem">
     <p>
      <code class="literal">
       Log_event
      </code>
      : Memory allocated for encoding
          transaction data into the binary log format; this is the same
          format in which Group Replication transmits data.
     </p>
    </li>
    <li class="listitem">
     <p>
      <code class="literal">
       write_set_extraction
      </code>
      : Memory allocated to
          the transaction's generated write set before it is committed.
     </p>
    </li>
    <li class="listitem">
     <p>
      <code class="literal">
       Gtid_set::to_string
      </code>
      : Memory allocated to
          stored the string representation of a GTID set.
     </p>
    </li>
    <li class="listitem">
     <p>
      <code class="literal">
       Gtid_set::Interval_chunk
      </code>
      : Memory allocated
          to store the GTID object.
     </p>
    </li>
   </ul>
  </div>
 </div>
 <br/>
</div>
