After reading
a blog post about MySQL Tuning scripts I thought about the possibility of a fully Automatic MySQL Tuner.
This is how it would work:
A daemon which would connect to your database server and then fetch status variables, just like mysqltuner and such. Then the daemon could decide that a parameter would need to be adjusted and then run "SET GLOBAL …" and write a /etc/mysql/autotuner.cf file which should be included in your my.cnf.
It should have a min/max setting for each option and some thresholds.
Why?
- Not everyone is a DBA
- It's could better than the default settings is most cases. Luckily many defaults are updated in 5.6.
- You're not using my-huge.cf, are you?
- It could help when there are changing workloads
- It might be sufficient for a developer environment
- MySQL might be embedded in a 'virtual appliance' which can be deployed on may different kinds of hardware.
Why not?
- The risk of it taking a wrong decision is too high
- It might be better then the defaults, but still worse than a trained DBA
- A few important settings (InnoDB Buffer Pool Size and InnoDB Logs) require a restart. I don't like anything to restart MySQL automatically (does your puppet config do automatic restarts?)
- It might generates differences between servers with the same role. This might not be an issue when the autotuner would use P2P/multicast to communicate with other autotuners, but that makes it even more scary
- I don't like bolted-on solutions
The conclusion is that I don't think this is a good solution.