With the recent upgrade of WHM/cPanel, the users get the ability to upgrade their MySQL server to 5.6.x ( x > 6 ).
However, when this upgrade is done, lot of server owners are seeing memory drainage issues. An idle MySQL server tends to consume around 50% of your RAM, which is a very serious concern. I had to upgrade a personal server of mine and faced serious issues with memory drainage. A more dig on this issue, highlighted a change brought around in the latest versions of MySQL with the parameter ‘performance_schema
‘.
Starting from MySQL 5.6.6, this parameter performance_schema
is enabled by default and it consumes the server memory even at an idle state. Performance Schema
automatically sizes the values of several of its parameters at server start-up if they are not set explicitly, which causes the memory usage to spike up.
The workaround for this issue is to disable performance_schema. This can be done by adding the following value to the configuration file – my.cnf
performance_schema = 0
Add this line and restart MySQL server. Things should be fine from now 🙂
Note : When you try to upgrade MySQL to 5.6.x, from a VPS with 1GB of RAM provisioned you will need to edit the config file and pass the keyword to disable performance_schema ( Yes, before the upgrade ). If not, there are chances for your upgrade to fail partly, due to MySQL upgrade script installing MySQL server components each and it gets killed due to over-usage of RAM as performance_schema is enabled by default.
If you do not want to disable performance_schema completely, you can adjust the settings of table_definition_cache to 400 and table_open_cache to 2000 or lower. This will cause performance_schema to use much less memory (in my case only 10% compared to table_definition_cache=1400)
You have to restart the server to see the changes in memory consumption.
Thank you Robert for the heads up !
If you do not want to disable performance_schema completely, you can adjust the settings of table_definition_cache to 400 and table_open_cache to 2000 or lower. This will cause performance_schema to use much less memory (in my case only 10% compared to table_definition_cache=1400)
You have to restart the server to see the changes in memory consumption.
Thank you Robert for the heads up !
Wow thank you very much!!!! I was on 85% now I’m at 35% of Memory Used. This upgrade was a headache :/
Hey,
Yes, this really was a headache !
Wow thank you very much!!!! I was on 85% now I’m at 35% of Memory Used. This upgrade was a headache :/
Hey,
Yes, this really was a headache !
Thanks mate. I have an EC2 small instance and it was the solution for my lack of memory since I’ve updated to MySQL 5.6. Cheers!
(y)
Thanks mate. I have an EC2 small instance and it was the solution for my lack of memory since I’ve updated to MySQL 5.6. Cheers!
(y)
Simple solution that made my life way less stressful… Thx a bunch man!
(y) cool!
Simple solution that made my life way less stressful… Thx a bunch man!
(y) cool!
Hi all,
We are desperate because mysql 5.7 in our servers is eating too much RAM and it restarts every 10min because kernel kills mysqld proccess.
We did everything: performance_schema OFF, variables with lower amounts.
Server has 32GB RAM in a ubuntu 16.04 64bits – 4.4.0-21-generic.
Any help?
Hi @macadanet, is this RAM usage during idle state or are there any queries in progress? You can view the process list by executing the following query : “SHOW [FULL] PROCESSLIST”. You can learn more about viewing process list on MySQL from :http://dev.mysql.com/doc/refman/5.7/en/processlist-table.html and http://dev.mysql.com/doc/refman/5.7/en/show-processlist.html
Hi Arun, please see further info here: http://dba.stackexchange.com/questions/139006/mysql-5-7-crashes-restarts-every-20min
Hi all,
We are desperate because mysql 5.7 in our servers is eating too much RAM and it restarts every 10min because kernel kills mysqld proccess.
We did everything: performance_schema OFF, variables with lower amounts.
Server has 32GB RAM in a ubuntu 16.04 64bits – 4.4.0-21-generic.
Any help?
Hi @macadanet, is this RAM usage during idle state or are there any queries in progress? You can view the process list by executing the following query : “SHOW [FULL] PROCESSLIST”. You can learn more about viewing process list on MySQL from :http://dev.mysql.com/doc/refman/5.7/en/processlist-table.html and http://dev.mysql.com/doc/refman/5.7/en/show-processlist.html
Hi Arun, please see further info here: http://dba.stackexchange.com/questions/139006/mysql-5-7-crashes-restarts-every-20min