<div id="docs-body">
 <div class="section">
  <div class="titlepage">
   <div>
    <div>
     <h4 class="title">
      <a name="mysql-cluster-log-statistics">
      </a>
      25.6.3.3 Using CLUSTERLOG STATISTICS in the NDB Cluster Management Client
     </h4>
    </div>
   </div>
  </div>
  <a class="indexterm" name="idm46045092765792">
  </a>
  <a class="indexterm" name="idm46045092764336">
  </a>
  <a class="indexterm" name="idm46045092763232">
  </a>
  <a class="indexterm" name="idm46045092761744">
  </a>
  <a class="indexterm" name="idm46045092760256">
  </a>
  <a class="indexterm" name="idm46045092758768">
  </a>
  <p>
   The
   <a class="link" href="mysql-cluster.html" title="Chapter 25 MySQL NDB Cluster 8.4">
    <code class="literal">
     NDB
    </code>
   </a>
   management client's
   <a class="link" href="mysql-cluster-logging-management-commands.html" title="25.6.3.1 NDB Cluster Logging Management Commands">
    <code class="literal">
     CLUSTERLOG STATISTICS
    </code>
   </a>
   command can provide a number of useful statistics in its output.
        Counters providing information about the state of the cluster
        are updated at 5-second reporting intervals by the transaction
        coordinator (TC) and the local query handler (LQH), and written
        to the cluster log.
  </p>
  <p>
   <b>
    Transaction coordinator statistics.
   </b>
   Each transaction has one transaction coordinator, which is
          chosen by one of the following methods:
  </p>
  <div class="itemizedlist">
   <ul class="itemizedlist" style="list-style-type: disc; ">
    <li class="listitem">
     <p>
      In a round-robin fashion
     </p>
    </li>
    <li class="listitem">
     <p>
      By communication proximity
     </p>
    </li>
    <li class="listitem">
     <p>
      By supplying a data placement hint when the transaction is
            started
     </p>
    </li>
   </ul>
  </div>
  <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
   <div class="admon-title">
    Note
   </div>
   <p>
    You can determine which TC selection method is used for
          transactions started from a given SQL node using the
    <a class="link" href="mysql-cluster-options-variables.html#sysvar_ndb_optimized_node_selection">
     <code class="literal">
      ndb_optimized_node_selection
     </code>
    </a>
    system variable.
   </p>
  </div>
  <p>
   All operations within the same transaction use the same
        transaction coordinator, which reports the following statistics:
  </p>
  <div class="itemizedlist">
   <ul class="itemizedlist" style="list-style-type: disc; ">
    <li class="listitem">
     <p>
      <b>
       Trans count.
      </b>
      This is the number transactions started in the last
              interval using this TC as the transaction coordinator. Any
              of these transactions may have committed, have been
              aborted, or remain uncommitted at the end of the reporting
              interval.
     </p>
     <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
      <div class="admon-title">
       Note
      </div>
      <p>
       Transactions do not migrate between TCs.
      </p>
     </div>
    </li>
    <li class="listitem">
     <p>
      <b>
       Commit count.
      </b>
      This is the number of transactions using this TC as the
              transaction coordinator that were committed in the last
              reporting interval. Because some transactions committed in
              this reporting interval may have started in a previous
              reporting interval, it is possible for
      <code class="literal">
       Commit
              count
      </code>
      to be greater than
      <code class="literal">
       Trans
              count
      </code>
      .
     </p>
    </li>
    <li class="listitem">
     <p>
      <b>
       Read count.
      </b>
      This is the number of primary key read operations using
              this TC as the transaction coordinator that were started
              in the last reporting interval, including simple reads.
              This count also includes reads performed as part of unique
              index operations. A unique index read operation generates
              2 primary key read operations—1 for the hidden
              unique index table, and 1 for the table on which the read
              takes place.
     </p>
    </li>
    <li class="listitem">
     <p>
      <b>
       Simple read count.
      </b>
      This is the number of simple read operations using this TC
              as the transaction coordinator that were started in the
              last reporting interval.
     </p>
    </li>
    <li class="listitem">
     <p>
      <b>
       Write count.
      </b>
      This is the number of primary key write operations using
              this TC as the transaction coordinator that were started
              in the last reporting interval. This includes all inserts,
              updates, writes and deletes, as well as writes performed
              as part of unique index operations.
     </p>
     <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
      <div class="admon-title">
       Note
      </div>
      <p>
       A unique index update operation can generate multiple PK
              read and write operations on the index table and on the
              base table.
      </p>
     </div>
    </li>
    <li class="listitem">
     <p>
      <b>
       AttrInfoCount.
      </b>
      This is the number of 32-bit data words received in the
              last reporting interval for primary key operations using
              this TC as the transaction coordinator. For reads, this is
              proportional to the number of columns requested. For
              inserts and updates, this is proportional to the number of
              columns written, and the size of their data. For delete
              operations, this is usually zero.
     </p>
     <p>
      Unique index operations generate multiple PK operations and
            so increase this count. However, data words sent to describe
            the PK operation itself, and the key information sent, are
      <span class="emphasis">
       <em>
        not
       </em>
      </span>
      counted here. Attribute information
            sent to describe columns to read for scans, or to describe
            ScanFilters, is also not counted in
      <code class="literal">
       AttrInfoCount
      </code>
      .
     </p>
    </li>
    <li class="listitem">
     <p>
      <b>
       Concurrent Operations.
      </b>
      This is the number of primary key or scan operations using
              this TC as the transaction coordinator that were started
              during the last reporting interval but that were not
              completed. Operations increment this counter when they are
              started and decrement it when they are completed; this
              occurs after the transaction commits. Dirty reads and
              writes—as well as failed operations—decrement
              this counter.
     </p>
     <p>
      The maximum value that
      <code class="literal">
       Concurrent
            Operations
      </code>
      can have is the maximum number of
            operations that a TC block can support; currently, this is
      <code class="literal">
       (2 * MaxNoOfConcurrentOperations) + 16 +
            MaxNoOfConcurrentTransactions
      </code>
      . (For more
            information about these configuration parameters, see the
      <em class="citetitle">
       Transaction Parameters
      </em>
      section of
      <a class="xref" href="mysql-cluster-ndbd-definition.html" title="25.4.3.6 Defining NDB Cluster Data Nodes">
       Section 25.4.3.6, “Defining NDB Cluster Data Nodes”
      </a>
      .)
     </p>
    </li>
    <li class="listitem">
     <p>
      <b>
       Abort count.
      </b>
      This is the number of transactions using this TC as the
              transaction coordinator that were aborted during the last
              reporting interval. Because some transactions that were
              aborted in the last reporting interval may have started in
              a previous reporting interval,
      <code class="literal">
       Abort
              count
      </code>
      can sometimes be greater than
      <code class="literal">
       Trans count
      </code>
      .
     </p>
    </li>
    <li class="listitem">
     <p>
      <b>
       Scans.
      </b>
      This is the number of table scans using this TC as the
              transaction coordinator that were started during the last
              reporting interval. This does not include range scans
              (that is, ordered index scans).
     </p>
    </li>
    <li class="listitem">
     <p>
      <b>
       Range scans.
      </b>
      This is the number of ordered index scans using this TC as
              the transaction coordinator that were started in the last
              reporting interval.
     </p>
    </li>
    <li class="listitem">
     <p>
      <b>
       Local reads.
      </b>
      This is the number of primary-key read operations
              performed using a transaction coordinator on a node that
              also holds the primary fragment replica of the record.
              This count can also be obtained from the
      <code class="literal">
       LOCAL_READS
      </code>
      counter in the
      <a class="link" href="mysql-cluster-ndbinfo-counters.html" title="25.6.17.13 The ndbinfo counters Table">
       <code class="literal">
        ndbinfo.counters
       </code>
      </a>
      table.
     </p>
    </li>
    <li class="listitem">
     <p>
      <b>
       Local writes.
      </b>
      This contains the number of primary-key read operations
              that were performed using a transaction coordinator on a
              node that also holds the primary fragment replica of the
              record. This count can also be obtained from the
      <code class="literal">
       LOCAL_WRITES
      </code>
      counter in the
      <a class="link" href="mysql-cluster-ndbinfo-counters.html" title="25.6.17.13 The ndbinfo counters Table">
       <code class="literal">
        ndbinfo.counters
       </code>
      </a>
      table.
     </p>
    </li>
   </ul>
  </div>
  <p>
   <b>
    Local query handler statistics (Operations).
   </b>
   There is 1 cluster event per local query handler block (that
          is, 1 per data node process). Operations are recorded in the
          LQH where the data they are operating on resides.
  </p>
  <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
   <div class="admon-title">
    Note
   </div>
   <p>
    A single transaction may operate on data stored in multiple
          LQH blocks.
   </p>
  </div>
  <p>
   The
   <code class="literal">
    Operations
   </code>
   statistic provides the number
        of local operations performed by this LQH block in the last
        reporting interval, and includes all types of read and write
        operations (insert, update, write, and delete operations). This
        also includes operations used to replicate writes. For example,
        in a cluster with two fragment replicas, the write to the
        primary fragment replica is recorded in the primary LQH, and the
        write to the backup is recorded in the backup LQH. Unique key
        operations may result in multiple local operations; however,
        this does
   <span class="emphasis">
    <em>
     not
    </em>
   </span>
   include local operations
        generated as a result of a table scan or ordered index scan,
        which are not counted.
  </p>
  <p>
   <b>
    Process scheduler statistics.
   </b>
   <a class="indexterm" name="idm46045092702960">
   </a>
   In addition to the statistics reported by the transaction
          coordinator and local query handler, each
   <a class="link" href="mysql-cluster-programs-ndbd.html" title="25.5.1 ndbd — The NDB Cluster Data Node Daemon">
    <span class="command">
     <strong>
      ndbd
     </strong>
    </span>
   </a>
   process has a scheduler which also
          provides useful metrics relating to the performance of an NDB
          Cluster. This scheduler runs in an infinite loop; during each
          loop the scheduler performs the following tasks:
  </p>
  <div class="orderedlist">
   <ol class="orderedlist" type="1">
    <li class="listitem">
     <p>
      Read any incoming messages from sockets into a job buffer.
     </p>
    </li>
    <li class="listitem">
     <p>
      Check whether there are any timed messages to be executed;
            if so, put these into the job buffer as well.
     </p>
    </li>
    <li class="listitem">
     <p>
      Execute (in a loop) any messages in the job buffer.
     </p>
    </li>
    <li class="listitem">
     <p>
      Send any distributed messages that were generated by
            executing the messages in the job buffer.
     </p>
    </li>
    <li class="listitem">
     <p>
      Wait for any new incoming messages.
     </p>
    </li>
   </ol>
  </div>
  <p>
   Process scheduler statistics include the following:
  </p>
  <div class="itemizedlist">
   <ul class="itemizedlist" style="list-style-type: disc; ">
    <li class="listitem">
     <p>
      <b>
       Mean Loop Counter.
      </b>
      This is the number of loops executed in the third step
              from the preceding list. This statistic increases in size
              as the utilization of the TCP/IP buffer improves. You can
              use this to monitor changes in performance as you add new
              data node processes.
     </p>
    </li>
    <li class="listitem">
     <p>
      <b>
       Mean send size and Mean receive size.
      </b>
      These statistics enable you to gauge the efficiency of,
              respectively writes and reads between nodes. The values
              are given in bytes. Higher values mean a lower cost per
              byte sent or received; the maximum value is 64K.
     </p>
    </li>
   </ul>
  </div>
  <p>
   To cause all cluster log statistics to be logged, you can use
        the following command in the
   <a class="link" href="mysql-cluster.html" title="Chapter 25 MySQL NDB Cluster 8.4">
    <code class="literal">
     NDB
    </code>
   </a>
   management client:
  </p>
  <div class="copytoclipboard-wrapper">
   <pre class="programlisting one-line language-ndbmgm"><div class="docs-select-all right" id="sa85097823"><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-ndbmgm"><span class="token prompt">ndb_mgm&gt;</span> <span class="token keyword">ALL</span> <span class="token keyword">CLUSTERLOG</span> <span class="token keyword">STATISTICS</span><span class="token operator">=</span>15</code></pre>
  </div>
  <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
   <div class="admon-title">
    Note
   </div>
   <p>
    Setting the threshold for
    <code class="literal">
     STATISTICS
    </code>
    to 15
          causes the cluster log to become very verbose, and to grow
          quite rapidly in size, in direct proportion to the number of
          cluster nodes and the amount of activity in the NDB Cluster.
   </p>
  </div>
  <p>
   For more information about NDB Cluster management client
        commands relating to logging and reporting, see
   <a class="xref" href="mysql-cluster-logging-management-commands.html" title="25.6.3.1 NDB Cluster Logging Management Commands">
    Section 25.6.3.1, “NDB Cluster Logging Management Commands”
   </a>
   .
  </p>
 </div>
 <br/>
</div>
