I have a CentOS server fully dedicated to MySQL 5.5 (with innodb tables mostly). Server has 32 GB RAM, SSD disks, and avarage memory usage looks like this:


So about 25GB is in use and about 6.5GB is cached. I am experiencing performance problems with WRITE queries, so I was thinking, is this the optimal cache size? I might increase innodb buffer size, so that linux cache would become smaller, or decrease it, so it would be bigger.

What is the optimal used/cached memory balance for busy MySQL server on linux?


Cached memory exists to make use of unused memory to speed up requests. So if you give all your memory to an application that can make use for it, you will see a performance increase. So to answer your question, there is no such thing as an optimal balance.


In general I would allocate as much cache to MySQL as possible if you're worried about MySQL performance. It knows what to cache, whereas the operating system cache doesn't -- it just caches frequently accessed files.

Regarding your performance issues, you could try running the database off a RAM disk if that's possible. Otherwise, use a filesystem that can make use of cache devices.


To answer directly to the heading of your question: No, that would be a very bad idea.

If you assign all of the free memory, +/- a few MB, to a program exclusively, any other program that will use some of your systems memory (e.g. if you use find from time to time or cronjobs running daily, weekly and so on) will have to swap.

If your system is going to swap, you will notice a huge decrease in overall performance.

  • Considering his setup, it is reasonable to allocate a giant portion of his memory to this one application since the server is dedicated to this one task. – Lucas Kauffman Sep 16 '12 at 15:31
  • I agree fully to your comment (yet he asked if he could "use up all memory" for his mysqld). However, he should keep in mind the memory requirements of other software running on his server. – leoben Sep 16 '12 at 16:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.