Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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:

free

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?

share|improve this question
    
"WRITE" queries? Do you mean INSERT and UPDATE statements? –  Michael Hampton Sep 16 '12 at 13:33
    
@Michael Hampton, yes, inset, update, delete. See my other question here: stackoverflow.com/questions/12316122 –  Temnovit Sep 16 '12 at 14:56
    
Have you heard of our sister site Database Administrators? They generally welcome questions regarding database performance tuning. –  Michael Hampton Sep 16 '12 at 14:59

3 Answers 3

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.

share|improve this answer

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.

share|improve this answer

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.

share|improve this answer
    
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

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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