There are quite a few "tuning primers" and "my.cnf generators" and "sample my.cnf files" online. The ultimate tool for generating an optimal my.cnf is not a tool. It's a human with many years of experience, deep knowledge of MySQL and the full application stack, and familiarity with your application and your data.
I don't know exactly the percentage, but quite a few of the servers I take a look at have been "optimized" with some tuning primer or question-and-answer script that spits out "optimal" parameters for my.cnf.
Most of the time these servers are far from optimal. Sometimes the my.cnf parameters are extremely wrong, to the point of causing a severe performance penalty.
If it were as easy as writing a tool to do this, don't you think Maatkit would have mk-optimal-mycnf already? In my opinion -- as someone who knows very well the complexity of creating a good my.cnf -- it's practically impossible. Much harder than syncing data, or manipulating a replication hierarchy, or any of the other things Maatkit can do already. And I doubt I'll ever even feel motivated to try creating such a tool.
Don't bother with scripts. Don't waste your time with most of the advice you see on the web in forums -- much of it is fundamentally wrong, even when it seems to come from an informed source. Don't put too much faith in the my.cnf samples that come with your operating system; many of them have very bad advice in the comments, such as instructing you on how to set up replication in ways that guarantee breakage.
If you want solid advice, ask someone who knows what they're doing (and can prove it). Or buy our book.
But even more fundamentally, you should not focus so much on my.cnf. It is not the be-all and end-all of performance. Tuning your server settings has far less impact on performance than tuning your schema, indexing, queries and -- you guessed it -- thinking deeply about your application architecture. Server settings are a distraction and a waste of time for most people.
Most my.cnf files I see only need minor tweaks, which give only so-so performance improvements. Tuning my.cnf only helps a lot when my.cnf has extremely bad parameters. The kind you'll get from tuning primers and automated my.cnf optimization scripts.
Entry posted by Baron Schwartz | 29 comments