Skip to content

Instantly share code, notes, and snippets.

@linuxmalaysia
Last active November 29, 2023 22:31
Show Gist options
  • Save linuxmalaysia/24a1e85e23d269b2897e486e63593aef to your computer and use it in GitHub Desktop.
Save linuxmalaysia/24a1e85e23d269b2897e486e63593aef to your computer and use it in GitHub Desktop.
Setting for MariaDB Gcache

Instructions for configuring MariaDB and MySQL performance :-

  1. File Modification:

    • Open the /etc/mysql/mariadb.cnf or my.cnf file (note that my.cnf is a soft link to mariadb.cnf).
    • Add the following configuration options:
    # Provider specific configuration options
    wsrep_provider_options="gcache.size=1024M;gmcast.segment=0;gcache.recover=yes"
    
    # Number of threads to process writesets from other nodes (depends on total CPU of the host)
    wsrep_slave_threads=8
  2. Understanding gcache:

    • Galera uses a preallocated file called gcache to store writesets in a circular buffer style.
    • The gcache size defines how many writesets the donor node can serve in Incremental State Transfer (IST).
    • You can estimate the downtime you can afford while still being able to perform an IST based on your write stream and gcache size.
  3. Improving Replication Performance:

    • Increasing the number of slave threads in Galera can improve throughput.
    • The impact is significant enough to be considered more than just a statistical anomaly.

For more detailed information, you can refer to these articles:

Please remember to handle database credentials securely when using such tools and ensure you have the necessary permissions to modify configuration files. Always backup your configuration files before making any changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment