Logging hurts MySQL performance - but, why?

Posted by jimbo on Server Fault See other posts from Server Fault or by jimbo
Published on 2011-11-22T14:09:38Z Indexed on 2011/11/22 17:57 UTC
Read the original article Hit count: 463

Filed under:
|
|
|

I'm quite surprised that I can't see an answer to this anywhere on the site already, nor in the MySQL documentation (section 5.2 seems to have logging otherwise well covered!)

If I enable binlogs, I see a small performance hit (subjectively), which is to be expected with a little extra IO -- but when I enable a general query log, I see an enormous performance hit (double the time to run queries, or worse), way in excess of what I see with binlogs. Of course I'm now logging every SELECT as well as every UPDATE/INSERT, but, other daemons record their every request (Apache, Exim) without grinding to a halt.

Am I just seeing the effects of being close to a performance "tipping point" when it comes to IO, or is there something fundamentally difficult about logging queries that causes this to happen? I'd love to be able to log all queries to make development easier, but I can't justify the kind of hardware it feels like we'd need to get performance back up with general query logging on.

I do, of course, log slow queries, and there's negligible improvement in general usage if I disable this.

(All of this is on Ubuntu 10.04 LTS, MySQLd 5.1.49, but research suggests this is a fairly universal issue)

© Server Fault or respective owner

Related posts about mysql

Related posts about Performance