Quantcast
Channel: Severalnines
Viewing all articles
Browse latest Browse all 1480

Understanding gcache in Galera

$
0
0
October 16, 2013
By Severalnines

Galera uses a preallocated file with a specific size called gcache, used to store the writesets in circular buffer style. By default, its size is 128MB. In this post, we are going to explore how to leverage gcache to improve the operation of a Galera cluster.

 

Test Case

 

We have a four node Galera cluster, using the latest release 23.2.7(r157). We have a table called t1 that is replicated by Galera on all nodes. The cluster nodes have allocated the default 128MB gcache.size, and we’ll try to execute a large writeset to see how gcache responds.

mysql>SHOW VARIABLES LIKE'wsrep_provider_options'\G
...
gcache.mem_size =0; gcache.name =/var/lib/mysql/galera.cache; gcache.size = 128M; gcache.page_size = 128M;
...

 

Let’s create a big writeset using LOAD DATA. The writeset size is about 200 MB in size:

mysql>LOADDATALOCALINFILE'/tmp/mysql_statistics.sql'INTOTABLE t1 FIELDSTERMINATED BY','OPTIONALLYENCLOSED BY'"'LINESTERMINATED BY'\n';
Query OK,3784725 rows affected (4min2.94 sec)
Records: 3784725  Deleted: 0  Skipped: 0Warnings: 0

 

You will notice gcache.page files will be generated to contain the big writeset, as reported in the MySQL error log:

[Note] WSREP: Created page /var/lib/mysql/gcache.page.000001 of size 208431655 bytes
[Note] WSREP: Deleted page /var/lib/mysql/gcache.page.000001

 

We are going to shut down one of the Galera nodes (node1) to see how it performs when rejoining the cluster:

$ service mysql stop

 

read more


Viewing all articles
Browse latest Browse all 1480

Trending Articles