Commit 70d4e55d authored by Marko Mäkelä's avatar Marko Mäkelä

MDEV-15053 fixup: Reduce contention in buf_page_get_low()

svr_n_page_hash_locks: Increase from 16 to 64. Before MDEV-15058,
we used to have the buf_pool.page_hash partitioned to each instance.

rw_lock_lock_word_decr(): Sleep a little in the spinloop.

rw_lock_s_lock_low(): Correct a comment. The function does perform
spinning.

This improves scalability in read-only workloads on a 32-CPU system
when the number of concurrent connections exceeds the CPU core count.

Thanks to Axel Schwenke for running benchmarks.
parent e8a21ed3
...@@ -19488,7 +19488,7 @@ static MYSQL_SYSVAR_ULONG(buffer_pool_chunk_size, srv_buf_pool_chunk_unit, ...@@ -19488,7 +19488,7 @@ static MYSQL_SYSVAR_ULONG(buffer_pool_chunk_size, srv_buf_pool_chunk_unit,
static MYSQL_SYSVAR_ULONG(page_hash_locks, srv_n_page_hash_locks, static MYSQL_SYSVAR_ULONG(page_hash_locks, srv_n_page_hash_locks,
PLUGIN_VAR_OPCMDARG | PLUGIN_VAR_READONLY, PLUGIN_VAR_OPCMDARG | PLUGIN_VAR_READONLY,
"Number of rw_locks protecting buffer pool page_hash. Rounded up to the next power of 2", "Number of rw_locks protecting buffer pool page_hash. Rounded up to the next power of 2",
NULL, NULL, 16, 1, MAX_PAGE_HASH_LOCKS, 0); NULL, NULL, 64, 1, MAX_PAGE_HASH_LOCKS, 0);
static MYSQL_SYSVAR_ULONG(doublewrite_batch_size, srv_doublewrite_batch_size, static MYSQL_SYSVAR_ULONG(doublewrite_batch_size, srv_doublewrite_batch_size,
PLUGIN_VAR_OPCMDARG | PLUGIN_VAR_READONLY, PLUGIN_VAR_OPCMDARG | PLUGIN_VAR_READONLY,
......
...@@ -320,8 +320,7 @@ rw_lock_validate( ...@@ -320,8 +320,7 @@ rw_lock_validate(
const rw_lock_t* lock); /*!< in: rw-lock */ const rw_lock_t* lock); /*!< in: rw-lock */
#endif /* UNIV_DEBUG */ #endif /* UNIV_DEBUG */
/******************************************************************//** /******************************************************************//**
Low-level function which tries to lock an rw-lock in s-mode. Performs no Low-level function which tries to lock an rw-lock in s-mode.
spinning.
@return TRUE if success */ @return TRUE if success */
UNIV_INLINE UNIV_INLINE
ibool ibool
......
...@@ -220,14 +220,13 @@ rw_lock_lock_word_decr( ...@@ -220,14 +220,13 @@ rw_lock_lock_word_decr(
return(true); return(true);
} }
ut_delay(1); (void) LF_BACKOFF();
} }
return(false); return(false);
} }
/******************************************************************//** /******************************************************************//**
Low-level function which tries to lock an rw-lock in s-mode. Performs no Low-level function which tries to lock an rw-lock in s-mode.
spinning.
@return TRUE if success */ @return TRUE if success */
UNIV_INLINE UNIV_INLINE
ibool ibool
......
...@@ -209,7 +209,7 @@ const ulint srv_buf_pool_def_size = 128 * 1024 * 1024; ...@@ -209,7 +209,7 @@ const ulint srv_buf_pool_def_size = 128 * 1024 * 1024;
ulong srv_buf_pool_chunk_unit; ulong srv_buf_pool_chunk_unit;
/** innodb_page_hash_locks (a debug-only parameter); /** innodb_page_hash_locks (a debug-only parameter);
number of locks to protect buf_pool.page_hash */ number of locks to protect buf_pool.page_hash */
ulong srv_n_page_hash_locks = 16; ulong srv_n_page_hash_locks = 64;
/** innodb_lru_scan_depth; number of blocks scanned in LRU flush batch */ /** innodb_lru_scan_depth; number of blocks scanned in LRU flush batch */
ulong srv_LRU_scan_depth; ulong srv_LRU_scan_depth;
/** innodb_flush_neighbors; whether or not to flush neighbors of a block */ /** innodb_flush_neighbors; whether or not to flush neighbors of a block */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment