**Reported in Launchpad by Dmytro Pinchukov last update 10-12-2017 04:17:46
I have a Percona server 5.6.28 with TokuDB running on a small (a VM with 1.6 GB of memory) amd64 Ubuntu Trusty system.
In the config file I have the following relevant settings:
key_buffer_size = 2M
max_allowed_packet = 4M
thread_stack = 192K
thread_cache_size = 8
max_connections = 40
query_cache_limit = 1M
query_cache_size = 8M
innodb_buffer_pool_size = 20M
innodb_log_buffer_size = 8M
tokudb_cache_size = 300M
Apart from the system databases and tables, there is only one database on this server with all of its tables using TokuDB.
There are two problems:
1) The actual amount of memory allocated by mysqld, despite the low configuration values, goes way beyond that. After a day of use, it stabilizes on approximately a 2.6GB mark. This memory seems to be never actually used, though.
2) Despite the 300M tokudb_cache_size setting, the mysqld process always uses approximately 0.5GB memory (allocated and actually used) more than that. It maxes out at about 850-870M after some time and stays there. It is reproducible with any cache size: set tokudb_cache_size to 1000M, and the mysqld process will grow to 1500-1600M, always half a gigabyte more than configured. Because of this, the default value of "half the system memory" doesn't work for me on small systems.
This doesn't happen with InnoDB, where the actual memory usage agrees quite well with the config settings (however the allocated memory amount still exceeds that substantially).
Please check the attached image which shows the memory usage over a day's period. Most of the "committed" memory that it shows (that is, allocated, but not used) belongs to mysqld.