Thread, InnoDB and MyISAM optimizations