# Memory usage problems (5.5.27 Percona XtraDB Cluster)

**URL:** <https://forums.percona.com/t/memory-usage-problems-5-5-27-percona-xtradb-cluster/2496>\
**Category:** Percona XtraDB Cluster 5.x\
**Created:** [November 5, 2012, 10:31am UTC](https://forums.percona.com/t/memory-usage-problems-5-5-27-percona-xtradb-cluster/2496 "2012-11-05T10:31:03Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![karileh](https://avatars.discourse-cdn.com/v4/letter/k/bb73d2/32.png) [@karileh](https://forums.percona.com/u/karileh)\
**Post date:** [November 5, 2012, 10:31am UTC](https://forums.percona.com/t/memory-usage-problems-5-5-27-percona-xtradb-cluster/2496/1 "2012-11-05T10:31:03Z")

</div>

I’m evaluating Percona XtraDB cluster in our Test environment (Amazon EC2 with 2 Small instances). Installation went easily but only problem seems to be that even under light utilization mysqld process size grows all the time without releasing the memory. I’m not familiar in debugging Mysql memory usage, so please advice if I need to provide some additional information.

OS: Centos 6.3

With following packages installed:

Percona-Server-shared-51-5.1.66-rel14.1.495.rhel6.x86\_64  
percona-release-0.0-1.x86\_64  
percona-xtrabackup-2.0.3-470.rhel6.x86\_64  
Percona-XtraDB-Cluster-client-5.5.27-23.6.356.rhel6.x86\_64  
Percona-XtraDB-Cluster-server-5.5.27-23.6.356.rhel6.x86\_64

Updated Galera to the latest available:  
galera-23.2.2-1.rhel5.x86\_64

mysql\> show status like ‘wsrep\_provider%’;±-----------------------±----------------------------------+| Variable\_name | Value |±-----------------------±----------------------------------+| wsrep\_provider\_name | Galera || wsrep\_provider\_vendor | Codership Oy \<info@codership.com\> || wsrep\_provider\_version | 23.2.2(r137) |±-----------------------±----------------------------------+

my.cnf:

[mysqld\_safe]  
wsrep\_urls=gcomm://10.0.0.101:4567,gcomm://10.0.0.102:4567,gcomm://

[mysqld]  
datadir=/var/lib/mysql/mysql\_data  
user=mysql  
log\_slave\_updates = 1  
binlog\_format=ROW  
max\_allowed\_packet = 200M  
default\_storage\_engine=InnoDB

#wsrep\_provider=/usr/lib64/libgalera\_smm.so  
wsrep\_provider=/usr/lib64/galera/libgalera\_smm.so  
wsrep\_slave\_threads=2  
wsrep\_cluster\_name=mycluster  
wsrep\_sst\_method=xtrabackup  
wsrep\_sst\_auth=root:  
wsrep\_node\_name=test-web01

innodb\_locks\_unsafe\_for\_binlog=1  
innodb\_autoinc\_lock\_mode=2  
innodb\_buffer\_pool\_size = 256M  
innodb\_additional\_mem\_pool\_size = 4M  
innodb\_log\_file\_size = 64M  
innodb\_log\_buffer\_size = 8M  
innodb\_flush\_method = O\_DIRECT  
innodb\_flush\_log\_at\_trx\_commit = 1

Here’s some tests I have done:

after starting Mysql top -command shows following:

PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND14103 mysql 20 0 1165m 84m 7268 S 0.0 5.1 0:00.31 mysqld

Mysql Status:

mysql\> status;--------------mysql Ver 14.14 Distrib 5.5.27, for Linux (x86\_64) using readline 5.1Connection id: 4Current database:Current user: root@localhostSSL: Not in useCurrent pager: stdoutUsing outfile: ''Using delimiter: ;Server version: 5.5.27 Percona XtraDB Cluster (GPL), wsrep\_23.6.r356Protocol version: 10Connection: Localhost via UNIX socketServer characterset: latin1Db characterset: latin1Client characterset: utf8Conn. characterset: utf8UNIX socket: /var/lib/mysql/mysql.sockUptime: 22 secThreads: 4 Questions: 12 Slow queries: 0 Opens: 33 Flush tables: 1 Open tables: 26 Queries per second avg: 0.545--------------

After some random queries (used our Mysql based application):

PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND15505 mysql 20 0 1559m 657m 135m S 0.0 39.7 1:46.74 mysqld

mysql\> status;--------------mysql Ver 14.14 Distrib 5.5.27, for Linux (x86\_64) using readline 5.1Connection id: 258Current database:Current user: root@localhostSSL: Not in useCurrent pager: stdoutUsing outfile: ''Using delimiter: ;Server version: 5.5.27 Percona XtraDB Cluster (GPL), wsrep\_23.6.r356Protocol version: 10Connection: Localhost via UNIX socketServer characterset: latin1Db characterset: latin1Client characterset: utf8Conn. characterset: utf8UNIX socket: /var/lib/mysql/mysql.sockUptime: 11 min 0 secThreads: 4 Questions: 62190 Slow queries: 0 Opens: 64 Flush tables: 1 Open tables: 57 Queries per second avg: 94.227--------------

Running Flush tables doesen’t release memory at all. Anyone else having these issue ? Or is there some misconfiguration ? Any help greatly appreciated.

---

<div class="post-metadata">

**Author:** ![karileh](https://avatars.discourse-cdn.com/v4/letter/k/bb73d2/32.png) [@karileh](https://forums.percona.com/u/karileh)\
**Post date:** [November 9, 2012, 8:10am UTC](https://forums.percona.com/t/memory-usage-problems-5-5-27-percona-xtradb-cluster/2496/2 "2012-11-09T08:10:48Z")

</div>

I’ve made some comparison between Standalone Percona Mysql Server 5.5.28 and XtraDB cluster mensioned above.

Standalone server has following packages installed:  
Percona-Server-server-55-5.5.28-rel29.1.335.rhel6.x86\_64  
Percona-Server-shared-55-5.5.28-rel29.1.335.rhel6.x86\_64  
Percona-Server-client-55-5.5.28-rel29.1.335.rhel6.x86\_64  
percona-release-0.0-1.x86\_64

With standalone installation I don’t see any memory leak. I compared with identical test and with XtraDB cluster memory usage grows rapidly w/o never releasing it. We just can’t consider using this in production if there’s no natural explanation for this.

I ran this test([URL][MySQL Bugs: #67259: MySQL 5.5.x uses more memory than 5.1.x when temporary tables are used](http://bugs.mysql.com/bug.php?id=67259%5B/URL%5D)) on both servers with same InnoDB memory settings:

create database ptest;use ptest;create table ti2(c1 int auto\_increment primary key, c2 char(255)) engine=InnoDB;insert into ti2(c2) values(‘abc’);insert into ti2(c2) select c2 from ti2;insert into ti2(c2) select c2 from ti2;insert into ti2(c2) select c2 from ti2;insert into ti2(c2) select c2 from ti2;insert into ti2(c2) select c2 from ti2;insert into ti2(c2) select c2 from ti2;insert into ti2(c2) select c2 from ti2;insert into ti2(c2) select c2 from ti2;insert into ti2(c2) select c2 from ti2;insert into ti2(c2) select c2 from ti2;insert into ti2(c2) select c2 from ti2;insert into ti2(c2) select c2 from ti2;insert into ti2(c2) select c2 from ti2;insert into ti2(c2) select c2 from ti2;insert into ti2(c2) select c2 from ti2;insert into ti2(c2) select c2 from ti2;insert into ti2(c2) select c2 from ti2;insert into ti2(c2) select c2 from ti2;insert into ti2(c2) select c2 from ti2;insert into ti2(c2) select c2 from ti2;insert into ti2(c2) select c2 from ti2;

Results of Percona-Server-server-55-5.5.28-rel29.1.335.rhel6.x86\_64

Before

PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 7077 mysql 20 0 756m 55m 5540 S 0.0 5.5 0:00.12 mysqld

After

PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 7077 mysql 20 0 756m 308m 5788 S 0.3 31.0 0:25.45 mysqld

Results of Percona-XtraDB-Cluster-server-5.5.27-23.6.356.rhel6.x86\_64

Before

PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 8951 mysql 20 0 1101m 83m 7160 S 0.0 5.1 0:00.29 mysqld

After

PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 8951 mysql 20 0 1741m 846m 2508 S 0.0 51.1 1:19.67 mysqld

Running more of these XtraDB cluster server will eventually run out memory.

---

<div class="post-metadata">

**Author:** ![rdab100](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/rdab100/32/8_2.png) [@rdab100](https://forums.percona.com/u/rdab100)\
**Post date:** [November 15, 2012, 8:12am UTC](https://forums.percona.com/t/memory-usage-problems-5-5-27-percona-xtradb-cluster/2496/3 "2012-11-15T08:12:34Z")

</div>

Thanks karileh looks like what I am seeing as well. We will look at testing it and capturing the memory usage.

We also have the galera cache set to 4G… this is going to be a page file in the main data\_dir as well as something in memory.

gcache.dir = /var/lib/mysql/;  
gcache.keep\_pages\_size = 0;  
gcache.mem\_size = 0;  
gcache.name = /var/lib/mysql//galera.cache;  
gcache.page\_size = 128M;  
gcache.size = 4G;

For those in the know should I be setting the gcache.page\_size, gcache.mem\_size too to limit these as well as I have set gcache.size? Is this in any way related to what karileh is seeing as well ? Should he have a configuration using the defaults (128MB, 128MB and 0)?

Dom
