lp:~laurynas-biveinis/percona-server/xtradb-empty-free-list-backoff

Created by Laurynas Biveinis on 2013-10-03 and last modified on 2013-10-04
Get this branch:
bzr branch lp:~laurynas-biveinis/percona-server/xtradb-empty-free-list-backoff
Only Laurynas Biveinis can upload to this branch. If you are Laurynas Biveinis please log in for upload directions.

Branch merges

Related bugs

Related blueprints

Branch information

Recent revisions

456. By Laurynas Biveinis on 2013-10-04

Implement backoff for free list consumers in the case of empty free
lists, blueprint
https://blueprints.launchpad.net/percona-server/+spec/xtradb-empty-free-list-backoff.

Currently, if buf_LRU_get_free_block() does not find a free page on
the free list, it loops with some wait while trying progressively
harder to get a free page: evict and eventually flush from the LRU
list, still checking the free list on each iteration. Even with the
implemented low-priority free list mutex acquisition for
buf_LRU_get_free_block(), such looping results in free list mutex
contention and LRU list mutex contention.

Fix by making buf_LRU_get_free_block() to skip all the other actions
it does except for the free list checking with a
progressively-increasing wait duration between the checks. Keep the
old algorithm accessible as an option and also for the code paths
where the cleaner thread is not running.

This is controlled through a new system variable
innodb_empty_free_list_algorithm=legacy|backoff, with backoff being
default. Add a sys_vars test for this variable.

At the same time, since now all the flushes are done by the cleaner
thread, the following situation is made possible and is thus
addressed. A query thread may take a page latch and wait for the
cleaner to perform an LRU flush. Meanwhile the cleaner might be
performing a flush list flush, and attempt to flush the page whose
page latch is held by that query thread. Before this situation would
have resulted in a single page flush by the query thread, and a latch
release which unblocks the page cleaner. With all flushing happenning
in page cleaner, this becomes a deadlock. Fixed by adjusting page
flush readiness condition in buf_flush_read_for_flush() for
BUF_FLUSH_LIST to match that of BUF_FLUSH_LRU, where flushing has been
already avoiding latched pages.

At the same time fix srv_cleaner_flush_chunk_size variable
initializater to match the system variable default for
innodb_cleaner_flush_chunk_size. The mismatch was visible in regular
vs. UNIV_PERF_DEBUG-compiled binaries.

Branch metadata

Branch format:
Branch format 7
Repository format:
Bazaar repository format 2a (needs bzr 1.16 or later)
Stacked on:
lp:percona-server/5.6
This branch contains Public information 
Everyone can see this information.