Solving MySQL suddenly occupy all memory problems

Pocketed a while ago on migrating from virtual host to an independent VPS,Maintenance of this all is my own。For performance,If your environment,Nature does not use the old configuration。

I use Ubuntu Server 16.04 + PHP 7.0 + Nginx + MySQL 5.7 In short,Stepped on a lot of holes。

Now,To record

Why MySQL is suddenly filling up memory

At first I thought it was a VPS under attack,But viewing card flow is not the only thing。First crash,I thought it was a configuration error,Added a bunch of cache,Reduced memory configuration, and so on。But not for long,Died again。

But why not to panic,This is a mystery。

In the repair table、Optimize MySQL configuration after a series of futile,Finally locate the problem:

Performance Schema

This is in the 5.6 Version began a feature enabled by default,It will quietly 400M memory MySQL started to speed up MySQL Enterprise Server running--for nearly,May be nothing,But for us this cock wire small VPS (my 1GB independent memory is not bad),Top day!

So,This is probably why my server crashed twice in a row recently。

To close the Performance Schema ,In your MySQL configuration file [mysqld] Field added in a sentence performance_schema = off

Such,My database is stable at around 300M。

Reference

Starting MySQL On Low Memory Virtual Machines

MySQL memory usage too high Analysis

Original article written by Gerber drop-off:R0uter's Blog » Solving MySQL suddenly occupy all memory problems

Reproduced Please keep the source and description link:https://www.logcg.com/archives/1757.html

About the Author

R0uter

The non-declaration,I have written articles are original,Reproduced, please indicate the link on this page and my name。

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *