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.