skip to Main Content

I’m trying to optimise the Digital Ocean droplet that my Laravel web app is running on, and have noticed that MySQL is constantly using ~50% of its 1GB RAM. By far the most common and well-attested method for decreasing MySQL’s memory footprint is to disable its Performance Schema feature by setting performance_schema = 0 in /etc/mysql/my.cnf.

However, no answer I’ve seen yet makes any mention of what exactly this feature does, why it’s enabled by default, and the implications of disabling it. To me it seems too be good to be true, and while I’m all for optimisation, I also don’t want to compromise the integrity of my web app’s server.

2

Answers


  1. The performance_schema is for monitoring and instrumenting the MySQL Server. Many types of monitoring tools may depend on it. I won’t describe the specific events it monitors, because that’s in the manual.

    You can run MySQL Server without the performance_schema enabled, but monitoring will be compromised. If you disable monitoring, you will not be able to diagnose performance problems or resource usage.

    The IT industry is becoming increasingly aware that monitoring is an important feature of servers and infrastructure. I don’t think it’s a good tradeoff to disable the performance_schema in MySQL Server to gain a mere 512MB of memory. If you are that constrained on memory, then you should reconsider if MySQL Server is the right technology choice for your platform.

    Login or Signup to reply.
  2. Disabling performance schema is perfectly fine and will save you some of that memory.

    No, it’s not too good to be true. To say that you’re compromising something is misleading. It’s left on by default because it can be useful and in most cases people can spare the memory, but like any tool you only need it if you’re going to use it. If you’re not going to use it, you’re absolutely free to turn it off with no negative impact at all.

    A small droplet that you run for a personal project is exactly the kind of use case where you would want to turn it off.

    Plus, you can always turn it on if you decide you need it (with the caveat that you wouldn’t have historical data).

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search