Monthly Archives: August 2016

Insane Default Insanity

performance_schema=OFF

The lack of that one line basically led to my blog being offline for over 8 months. That’s ridiculous, but I had other things to do than investigate why MySQL would be OOM killed on my personal blog when clamping down on known memory settings did nothing. In the same vein of ridiculous things, my MySQL server was using 450MB on startup when I’d given it a 5MB innodb_buffer_pool_size. What the shit. It has been years since I’ve had to heavily tune MySQL, but this is a very low traffic blog with a very simple setup. Why is it practically on fire and getting OOM killed every day or two?

I’ve had an unusual bought of time to devote to personal projects in this week, and somebody at work asked me today if I blogged. I decided I’d resurrect the thing.

The fact that this is all contained in two linked docker files that aren’t document didn’t make it easier to deal with. But there I was, holy hell fire and all, with MySQL taking up 450MB without Apache running. I’d fire up WordPress and down went the ship as the whole server would lock up for a few minutes until every last malloc was at its wits end and the kernel OOM’d MySQL, and sometimes Apache with it.

[mysqld]
innodb_buffer_pool_size=5M
innodb_log_buffer_size=256K

With those absurdly small values at play and the memory entirely unaffected, I was now using refined Google searches like “mysql too much memory”. And there was hint at the unholy answer from somebody else burning up too much memory:

With your configuration, before running no query, you need 1.5 GB of static memory assignment- before the buffer pool is even used an no connection is performed. Most of it (1GB) goes to performance_schema, but there is still 500MB that are allocated (vs the 42k for the default configuration).

Somewhere along the line, the new version of MySQL managed to, by default, use intense amounts of memory on startup for a profiling feature that I didn’t care want. More than that, I’d argue that it’s not the kind of thing you’d want to turn on be default in system. If it takes expert knowledge to use it, and it puts a load on the system (in this case, an extreme of 10-20x jump in memory use at idle vs. being disabled), then it should be something that is only actively turned on.

What a terrible little gift I had waiting for me.