Skip to content
logo
Percona XtraDB Cluster
Perfomance Schema instrumentation
Initializing search
    percona/pxc-docs
    percona/pxc-docs
    • Home
      • About Percona XtraDB Cluster
      • Percona XtraDB Cluster limitations
      • Understand version numbers
      • Quick start guide for Percona XtraDB Cluster
      • Install Percona XtraDB Cluster
      • Configure nodes for write-set replication
      • Bootstrap the first node
      • Add nodes to cluster
      • Verify replication
      • High availability
      • PXC strict mode
      • Online schema upgrade
      • Non-Blocking Operations (NBO) method for Online Scheme Upgrades (OSU)
      • Security basics
      • Secure the network
      • Encrypt PXC traffic
      • Enable AppArmor
      • Enable SELinux
      • State snapshot transfer
      • Percona XtraBackup SST configuration
      • Restart the cluster nodes
      • Cluster failover
      • Monitor the cluster
      • Certification in Percona XtraDB Cluster
      • Percona XtraDB Cluster threading model
      • Understand GCache and Record-Set cache
      • GCache encryption and Write-Set cache encryption
      • Perfomance Schema instrumentation
        • What is not exposed ?
        • Use pxc_cluster_view
      • Data at Rest Encryption
      • Upgrade Percona XtraDB Cluster
      • Crash recovery
      • Configure Percona XtraDB Cluster on CentOS
      • Configure Percona XtraDB Cluster on Ubuntu
      • Set up Galera arbitrator
      • How to set up a three-node cluster on a single box
      • How to set up a three-node cluster in EC2 environment
      • Load balancing with HAProxy
      • Load balancing with ProxySQL
      • ProxySQL admin utilities
      • Setting up a testing environment with ProxySQL
      • Release notes index
      • Percona XtraDB Cluster 8.0.31-23 (2023-03-14)
      • Percona XtraDB Cluster 8.0.30-22.md (2022-12-28)
      • Percona XtraDB Cluster 8.0.29-21 (2022-09-12)
      • Percona XtraDB Cluster 8.0.28-19.1 (2022-07-19)
      • Percona XtraDB Cluster 8.0.27-18.1
      • Percona XtraDB Cluster 8.0.26-16.1
      • Percona XtraDB Cluster 8.0.25-15.1
      • Percona XtraDB Cluster 8.0.23-14.1
      • Percona XtraDB Cluster 8.0.22-13.1
      • Percona XtraDB Cluster 8.0.21-12.1
      • Percona XtraDB Cluster 8.0.20-11
      • Percona XtraDB Cluster 8.0.20-11.3
      • Percona XtraDB Cluster 8.0.20-11.2
      • Percona XtraDB Cluster 8.0.19-10
      • Percona XtraDB Cluster 8.0.18-9.3
      • Index of wsrep status variables
      • Index of wsrep system variables
      • Index of wsrep_provider options
      • Index of files created by PXC
      • Frequently asked questions
      • Glossary
      • Copyright and licensing information
      • Trademark policy

    • What is not exposed ?
    • Use pxc_cluster_view

    Perfomance Schema instrumentation¶

    To improve monitoring Percona XtraDB Cluster has implemented an infrastructure to expose Galera instruments (mutexes, cond-variables, files, threads) as a part of PERFORMANCE_SCHEMA.

    Although mutexes and condition variables from wsrep were already part of PERFORMANCE_SCHEMA threads were not.

    Mutexes, condition variables, threads, and files from Galera library also were not part of the PERFORMANCE_SCHEMA.

    You can see the complete list of available instruments by running:

    mysql> SELECT * FROM performance_schema.setup_instruments WHERE name LIKE '%galera%' OR name LIKE '%wsrep%';
    
    Expected output
    +----------------------------------------------------------+---------+-------+
    | NAME                                                     | ENABLED | TIMED |
    +----------------------------------------------------------+---------+-------+
    | wait/synch/mutex/sql/LOCK_wsrep_ready                    | NO      | NO    |
    | wait/synch/mutex/sql/LOCK_wsrep_sst                      | NO      | NO    |
    | wait/synch/mutex/sql/LOCK_wsrep_sst_init                 | NO      | NO    |
    ...
    | stage/wsrep/wsrep: in rollback thread                    | NO      | NO    |
    | stage/wsrep/wsrep: aborter idle                          | NO      | NO    |
    | stage/wsrep/wsrep: aborter active                        | NO      | NO    |
    +----------------------------------------------------------+---------+-------+
    73 rows in set (0.00 sec)
    

    Some of the most important are:

    • Two main actions that Galera does are REPLICATION and ROLLBACK. Mutexes, condition variables, and threads related to this are part of PERFORMANCE_SCHEMA.

    • Galera internally uses monitor mechanism to enforce ordering of events. These monitor control events apply and are mainly responsible for the wait between different action. All such monitor mutexes and condition variables are covered as part of this implementation.

    • There are lot of other miscellaneous action related to receiving of package and servicing messages. Mutexes and condition variables needed for them are now visible too. Threads that manage receiving and servicing are also being instrumented.

    This feature has exposed all the important mutexes, condition variables that lead to lock/threads/files as part of this process.

    Besides exposing file it also tracks write/read bytes like stats for file. These stats are not exposed for Galera files as Galera uses mmap.

    Also, there are some threads that are short-lived and created only when needed especially for SST/IST purpose. They are also tracked but come into PERFORMANCE_SCHEMA tables only if/when they are created.

    Stage Info from Galera specific function which server updates to track state of running thread is also visible in PERFORMANCE_SCHEMA.

    What is not exposed ?¶

    Galera uses customer data-structure in some cases (like STL structures). Mutexes used for protecting these structures which are not part of mainline Galera logic or doesn’t fall in big-picture are not tracked. Same goes with threads that are gcomm library specific.

    Galera maintains a process vector inside each monitor for its internal graph creation. This process vector is 65K in size and there are two such vectors per monitor. That is 128K * 3 = 384K condition variables. These are not tracked to avoid hogging PERFORMANCE_SCHEMA limits and sidelining of the main crucial information.

    Use pxc_cluster_view¶

    The pxc_cluster_view - provides a unified view of the cluster. The table is in the Performance_Schema database.

    DESCRIBE pxc_cluster_view;
    

    This table has the following definition:

    Expected output
    +-------------+--------------+------+-----+---------+-------+
    | Field       | Type         | Null | Key | Default | Extra |
    +-------------+--------------+------+-----+---------+-------+
    | HOST_NAME   | char(64)     | NO   |     | NULL    |       |
    | UUID        | char(36)     | NO   |     | NULL    |       |
    | STATUS      | char(64)     | NO   |     | NULL    |       |
    | LOCAL_INDEX | int unsigned | NO   |     | NULL    |       |
    | SEGMENT     | int unsigned | NO   |     | NULL    |       |
    +-------------+--------------+------+-----+---------+-------+
    5 rows in set (0.00 sec)
    

    To view the table, run the following query:

    SELECT * FROM pxc_cluster_view;
    
    Expected output
    +-----------+--------------------------------------+--------+-------------+---------+
    | HOST_NAME | UUID                                 | STATUS | LOCAL_INDEX | SEGMENT |
    +-----------+--------------------------------------+--------+-------------+---------+
    | node1     | 22b9d47e-c215-11eb-81f7-7ed65a9d253b | SYNCED |           0 |       0 |
    | node3     | 29c51cf5-c216-11eb-9101-1ba3a28e377a | SYNCED |           1 |       0 |
    | node2     | 982cdb03-c215-11eb-9865-0ae076a59c5c | SYNCED |           2 |       0 |
    +-----------+--------------------------------------+--------+-------------+---------+
    3 rows in set (0.00 sec)
    

    Contact us

    For free technical help, visit the Percona Community Forum.

    To report bugs or submit feature requests, open a JIRA ticket.

    For paid support and managed or consulting services , contact Percona Sales.


    Last update: 2023-01-20
    Percona LLC and/or its affiliates, © 2023
    Made with Material for MkDocs

    Cookie consent

    We use cookies to recognize your repeated visits and preferences, as well as to measure the effectiveness of our documentation and whether users find what they're searching for. With your consent, you're helping us to make our documentation better.