Comments on: The mystery of MySQL 5.6 excessive buffer pool flushing https://shlomi-noach.github.io/blog/mysql/the-mystery-of-mysql-5-6-excessive-buffer-pool-flushing Blog by Shlomi Noach Mon, 09 Jun 2014 07:03:38 +0000 hourly 1 https://wordpress.org/?v=5.3.3 By: Introducing Orchestrator: manage and visualize your MySQL replication topologies and get home for dinner | code.openark.org https://shlomi-noach.github.io/blog/mysql/the-mystery-of-mysql-5-6-excessive-buffer-pool-flushing/comment-page-1#comment-244307 Mon, 09 Jun 2014 07:03:38 +0000 https://shlomi-noach.github.io/blog/?p=6843#comment-244307 […] The mystery of MySQL 5.6 excessive buffer pool flushing […]

]]>
By: Introducing Orchestrator: manage and visualize your MySQL replication topologies and get home for dinner | Outbrain Techblog https://shlomi-noach.github.io/blog/mysql/the-mystery-of-mysql-5-6-excessive-buffer-pool-flushing/comment-page-1#comment-244306 Mon, 09 Jun 2014 07:02:37 +0000 https://shlomi-noach.github.io/blog/?p=6843#comment-244306 […] not GTID? We’re using MySQL 5.5. We’ve had issues while evaluating 5.6; and besides, migrating to GTID is a mess (several solutions or proposed […]

]]>
By: Vassil Velichkov https://shlomi-noach.github.io/blog/mysql/the-mystery-of-mysql-5-6-excessive-buffer-pool-flushing/comment-page-1#comment-239603 Mon, 05 May 2014 04:20:54 +0000 https://shlomi-noach.github.io/blog/?p=6843#comment-239603 We have upgraded one of our MySQL servers from Percona MySQL 5.5 to Percona MySQL 5.6, while at the same time we have upgraded another server from plain 5.5. to 5.6. After the upgrade, without any changes in the application code, both servers experience constant spikes in flushing activity, well beyond the innodb_io_capaicty_max setting. In the last 20 hours I’ve tried any combination of the same parameters described by Shlomi in his post + some more:
innodb_flush_method = O_DIRECT / O_DIRECT_NO_FSYNC (actually this helped a bit – same IOPS spikes, but causing only 1/3 of the max disk latency
innodb_lru_scan_depth = 1024 / 2048 / 4096
innodb_flushing_avg_loops = 10 / 20 / 30 / 40 / 50 / 60

I will continue to investigate, but what makes feel weird is that the adaptive flushing never really kicks in, until is too late and then buffer_flush_background_total_pages shows rapid increase and all 50K dirty pages are being flushed at a rate approx. 3 x innodb_io_capacity_max…

]]>
By: shlomi https://shlomi-noach.github.io/blog/mysql/the-mystery-of-mysql-5-6-excessive-buffer-pool-flushing/comment-page-1#comment-239422 Sat, 03 May 2014 03:38:31 +0000 https://shlomi-noach.github.io/blog/?p=6843#comment-239422 @Rolando, as per my comment #9, my submitted bug report turns into “valid behaviour”. I am still without solution for excessive flushing.

]]>
By: Rolando Edwards https://shlomi-noach.github.io/blog/mysql/the-mystery-of-mysql-5-6-excessive-buffer-pool-flushing/comment-page-1#comment-239383 Fri, 02 May 2014 17:41:48 +0000 https://shlomi-noach.github.io/blog/?p=6843#comment-239383 Correction on my post : I meant to say “If the flushing algorithm has to look for contiguous dirty pages only, there should be no reason for excessive flushing.”

]]>
By: Rolando Edwards https://shlomi-noach.github.io/blog/mysql/the-mystery-of-mysql-5-6-excessive-buffer-pool-flushing/comment-page-1#comment-239382 Fri, 02 May 2014 17:39:32 +0000 https://shlomi-noach.github.io/blog/?p=6843#comment-239382 It’s ironic how in the MySQL Doc on “Controlling the Flushing Rate of Dirty Pages from the InnoDB Buffer Pool” reads a little differently of late.

MySQL 5.5 says : InnoDB performs certain tasks in the background, including flushing of dirty pages (those pages that have been changed but are not yet written to the database files) from the buffer pool, a task performed by the master thread. Currently, InnoDB aggressively flushes buffer pool pages if the percentage of dirty pages in the buffer pool exceeds innodb_max_dirty_pages_pct.

MySQL 5.6 says : InnoDB performs certain tasks in the background, including flushing of dirty pages (those pages that have been changed but are not yet written to the database files) from the buffer pool. Currently, InnoDB flushes buffer pool pages if the percentage of dirty pages in the buffer pool exceeds innodb_max_dirty_pages_pct.

Interstng how the MySQL 5.6 Doc does not say “aggressively”. Maybe something did change.

Someone should look into whether the introduction of innodb_flush_neighbors may have altered the way flushing is evaluated and subsequently performed.

The option innodb_flush_neighbors was introduced in MySQL 5.6. It’s default behavior to flush contiguous dirty pages.

MySQL 5.5 flushing can rightly be called “aggressive” if it flushes anything dirty in the buffer pool, contiguous or not.

MySQL 5.6 is supposed to be conservative in its default innodb_flush_neighbors setting. If the flushing algorithm has to look for contiguous dirty pages only, there should be reason for excessive flushing.

If this algorithm is faulty and not properly taking innodb_max_dirty_pages_pct in account, this excessive flushing could possibly be a manifestation of such code.

Of course, all this is just my conjecture. Notwithstanding, I would like to see what your submitted bug report turns up.

]]>
By: shlomi https://shlomi-noach.github.io/blog/mysql/the-mystery-of-mysql-5-6-excessive-buffer-pool-flushing/comment-page-1#comment-238573 Thu, 24 Apr 2014 13:56:12 +0000 https://shlomi-noach.github.io/blog/?p=6843#comment-238573 For completeness, it seems like the buffer_pool_pages_* weird values are actually valid, according to this: http://bugs.mysql.com/bug.php?id=59550 (compressed pages are counted inconsistently with total num pages the way I understand it)

]]>
By: shlomi https://shlomi-noach.github.io/blog/mysql/the-mystery-of-mysql-5-6-excessive-buffer-pool-flushing/comment-page-1#comment-238397 Tue, 22 Apr 2014 18:03:25 +0000 https://shlomi-noach.github.io/blog/?p=6843#comment-238397 Hair turning grey. After some hunting, I came upon this:

mysql> select name, count from INNODB_METRICS where name like '%buff%pool%page%';
+-------------------------+----------+
| name                    | count    |
+-------------------------+----------+
| buffer_pool_pages_total |  3014627 |
| buffer_pool_pages_misc  | -1808588 |
| buffer_pool_pages_data  |  4822230 |
| buffer_pool_pages_dirty |   488383 |
| buffer_pool_pages_free  |      985 |
+-------------------------+----------+

At this stage I will stop 5.6 evaluation and wait for higher forces to put sense into life. Have submitted bug report: http://bugs.mysql.com/bug.php?id=72423

]]>
By: shlomi https://shlomi-noach.github.io/blog/mysql/the-mystery-of-mysql-5-6-excessive-buffer-pool-flushing/comment-page-1#comment-238387 Tue, 22 Apr 2014 15:18:55 +0000 https://shlomi-noach.github.io/blog/?p=6843#comment-238387 Laurynas, Dimitry,
thanks both – will take further measurement and report.

]]>
By: Dimitri Kravtchuk https://shlomi-noach.github.io/blog/mysql/the-mystery-of-mysql-5-6-excessive-buffer-pool-flushing/comment-page-1#comment-238385 Tue, 22 Apr 2014 15:16:10 +0000 https://shlomi-noach.github.io/blog/?p=6843#comment-238385 [posting on behalf of Dimitri; SN]

what is great that since MySQL 5.6 there is more and more instrumentation generally present in the code and yet more in InnoDB via its METRICS table.

so, let’s try to understand first from where the suspected flushing is coming..

first of all you have to enable METRICS counters :
mysql> set global innodb_monitor_enable = ‘%’

(or just have innodb_monitor_enable=’%’ in your my.conf file on startup)

then, using information_schema, start to monitor your flushing activity :

mysql> select name, count from INNODB_METRICS where name like '%flush%tot%';
+-------------------------------------+-------+
| name                                | count |
+-------------------------------------+-------+
| buffer_flush_batch_total_pages      |    96 |
| buffer_flush_neighbor_total_pages   |     0 |
| buffer_flush_adaptive_total_pages   |     0 |
| buffer_flush_sync_total_pages       |     0 |
| buffer_flush_background_total_pages |    96 |
| buffer_LRU_batch_flush_total_pages  |     0 |
+-------------------------------------+-------+
6 rows in set (0.00 sec)

(of course more helpful will be to get the diff/sec graphed from these values to see the tendency)..

once you’ll have an idea to which flush processing your IO activity is related, you may then get a look on all %flush% counters, etc..

]]>