Documentation Home
MySQL 9.0 Reference Manual
Related Documentation Download this Manual
PDF (US Ltr) - 40.0Mb
PDF (A4) - 40.1Mb
Man Pages (TGZ) - 259.0Kb
Man Pages (Zip) - 366.2Kb
Info (Gzip) - 4.0Mb
Info (Zip) - 4.0Mb


MySQL 9.0 Reference Manual  / ...  / MySQL NDB Cluster 9.0  / Management of NDB Cluster  /  NDB Cluster and the Performance Schema

25.6.19 NDB Cluster and the Performance Schema

NDB provides information in the MySQL Performance Schema aboutndbcluster plugin threads and instrumenting for transaction batch memory. These features are described in greater detail in the sections which follow.

ndbcluster Plugin Threads

ndbcluster plugin threads are visible in the Performance Schemathreads table, as shown in the following query:

mysql> SELECT name, type, thread_id, thread_os_id    -> FROM performance_schema.threads    -> WHERE name LIKE '%ndbcluster%'\G+----------------------------------+------------+-----------+--------------+| name                             | type       | thread_id | thread_os_id |+----------------------------------+------------+-----------+--------------+| thread/ndbcluster/ndb_binlog     | BACKGROUND |        30 |        11980 || thread/ndbcluster/ndb_index_stat | BACKGROUND |        31 |        11981 || thread/ndbcluster/ndb_metadata   | BACKGROUND |        32 |        11982 |+----------------------------------+------------+-----------+--------------+

Thethreads table shows all three of the threads listed here:

  • ndb_binlog: Binary logging thread

  • ndb_index_stat: Index statistics thread

  • ndb_metadata: Metadata thread

These threads are also shown by name in thesetup_threads table.

Thread names are shown in thename column of thethreads andsetup_threads tables using the formatprefix/plugin_name/thread_name.prefix, the object type as determined by theperformance_schema engine, isthread for plugin threads (seeThread Instrument Elements). Theplugin_name isndbcluster.thread_name is the standalone name of the thread (ndb_binlog,ndb_index_stat, orndb_metadata).

Using the thread ID or OS thread ID for a given thread in thethreads orsetup_threads table, it is possible to obtain considerable information from Performance Schema about plugin execution and resource usage. This example shows how to obtain the amount of memory allocated by the threads created by thendbcluster plugin from themem_root arena by joining thethreads andmemory_summary_by_thread_by_event_name tables:

mysql> SELECT    ->   t.name,    ->   m.sum_number_of_bytes_alloc,    ->   IF(m.sum_number_of_bytes_alloc > 0, "true", "false") AS 'Has allocated memory'    -> FROM performance_schema.memory_summary_by_thread_by_event_name m    -> JOIN performance_schema.threads t    -> ON m.thread_id = t.thread_id    -> WHERE t.name LIKE '%ndbcluster%'    ->   AND event_name LIKE '%THD::main_mem_root%';+----------------------------------+---------------------------+----------------------+| name                             | sum_number_of_bytes_alloc | Has allocated memory |+----------------------------------+---------------------------+----------------------+| thread/ndbcluster/ndb_binlog     |                     20576 | true                 || thread/ndbcluster/ndb_index_stat |                         0 | false                || thread/ndbcluster/ndb_metadata   |                      8240 | true                 |+----------------------------------+---------------------------+----------------------+

Transaction Memory Usage

You can see the amount of memory used for transaction batching by querying the Performance Schemamemory_summary_by_thread_by_event_name table, similar to what is shown here:

mysql> SELECT EVENT_NAME    ->   FROM performance_schema.memory_summary_by_thread_by_event_name    ->   WHERE THREAD_ID = PS_CURRENT_THREAD_ID()    ->     AND EVENT_NAME LIKE 'memory/ndbcluster/%';+-------------------------------------------+| EVENT_NAME                                |+-------------------------------------------+| memory/ndbcluster/Thd_ndb::batch_mem_root |+-------------------------------------------+1 row in set (0.01 sec)

Thendbcluster transaction memory instrument is also visible in the Performance Schemasetup_instruments table, as shown here:

mysql> SELECT * from performance_schema.setup_instruments    ->   WHERE NAME LIKE '%ndb%'\G*************************** 1. row ***************************         NAME: memory/ndbcluster/Thd_ndb::batch_mem_root      ENABLED: YES        TIMED: NULL   PROPERTIES:   VOLATILITY: 0DOCUMENTATION: Memory used for transaction batching1 row in set (0.01 sec)