Commit 6cb615b2 authored by Mikael Ronstrom's avatar Mikael Ronstrom

3 google patches

SMP patch
Rate IO patch
Multiple IO threads patch
parent ee89d3f1
...@@ -133,6 +133,14 @@ static my_bool innobase_adaptive_hash_index = TRUE; ...@@ -133,6 +133,14 @@ static my_bool innobase_adaptive_hash_index = TRUE;
static char* internal_innobase_data_file_path = NULL; static char* internal_innobase_data_file_path = NULL;
/* Max number of IO requests merged to perform large IO in background
IO threads.
*/
long innobase_max_merged_io = 64;
/* Number of background IO threads for read and write. */
long innobase_read_io_threads, innobase_write_io_threads;
/* The following counter is used to convey information to InnoDB /* The following counter is used to convey information to InnoDB
about server activity: in selects it is not sensible to call about server activity: in selects it is not sensible to call
srv_active_wake_master_thread after each fetch or search, we only do srv_active_wake_master_thread after each fetch or search, we only do
...@@ -1606,6 +1614,9 @@ innobase_init( ...@@ -1606,6 +1614,9 @@ innobase_init(
srv_mem_pool_size = (ulint) innobase_additional_mem_pool_size; srv_mem_pool_size = (ulint) innobase_additional_mem_pool_size;
srv_n_file_io_threads = (ulint) innobase_file_io_threads; srv_n_file_io_threads = (ulint) innobase_file_io_threads;
srv_n_read_io_threads = (ulint) innobase_read_io_threads;
srv_n_write_io_threads = (ulint) innobase_write_io_threads;
srv_max_merged_io = (ulint) innobase_max_merged_io;
srv_lock_wait_timeout = (ulint) innobase_lock_wait_timeout; srv_lock_wait_timeout = (ulint) innobase_lock_wait_timeout;
srv_force_recovery = (ulint) innobase_force_recovery; srv_force_recovery = (ulint) innobase_force_recovery;
...@@ -8118,6 +8129,21 @@ static MYSQL_SYSVAR_LONG(file_io_threads, innobase_file_io_threads, ...@@ -8118,6 +8129,21 @@ static MYSQL_SYSVAR_LONG(file_io_threads, innobase_file_io_threads,
"Number of file I/O threads in InnoDB.", "Number of file I/O threads in InnoDB.",
NULL, NULL, 4, 4, 64, 0); NULL, NULL, 4, 4, 64, 0);
static MYSQL_SYSVAR_LONG(write_io_threads, innobase_write_io_threads,
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
"Number of write I/O threads in InnoDB.",
NULL, NULL, 1, 1, 64, 0);
static MYSQL_SYSVAR_LONG(read_io_threads, innobase_read_io_threads,
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
"Number of read I/O threads in InnoDB.",
NULL, NULL, 1, 1, 64, 0);
static MYSQL_SYSVAR_LONG(max_merged_io, innobase_max_merged_io,
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
"Max number of adjacent IO requests to merge in InnoDB.",
NULL, NULL, 64, 1, 64, 0);
static MYSQL_SYSVAR_LONG(force_recovery, innobase_force_recovery, static MYSQL_SYSVAR_LONG(force_recovery, innobase_force_recovery,
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY, PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
"Helps to save your data in case the disk image of the database becomes corrupt.", "Helps to save your data in case the disk image of the database becomes corrupt.",
...@@ -8197,6 +8223,9 @@ static struct st_mysql_sys_var* innobase_system_variables[]= { ...@@ -8197,6 +8223,9 @@ static struct st_mysql_sys_var* innobase_system_variables[]= {
MYSQL_SYSVAR(doublewrite), MYSQL_SYSVAR(doublewrite),
MYSQL_SYSVAR(fast_shutdown), MYSQL_SYSVAR(fast_shutdown),
MYSQL_SYSVAR(file_io_threads), MYSQL_SYSVAR(file_io_threads),
MYSQL_SYSVAR(read_io_threads),
MYSQL_SYSVAR(write_io_threads),
MYSQL_SYSVAR(max_merged_io),
MYSQL_SYSVAR(file_per_table), MYSQL_SYSVAR(file_per_table),
MYSQL_SYSVAR(flush_log_at_trx_commit), MYSQL_SYSVAR(flush_log_at_trx_commit),
MYSQL_SYSVAR(flush_method), MYSQL_SYSVAR(flush_method),
......
...@@ -535,21 +535,19 @@ os_file_create_subdirs_if_needed( ...@@ -535,21 +535,19 @@ os_file_create_subdirs_if_needed(
FALSE otherwise */ FALSE otherwise */
const char* path); /* in: path name */ const char* path); /* in: path name */
/**************************************************************************** /****************************************************************************
Initializes the asynchronous io system. Creates separate aio array for Initializes the asynchronous io system. Creates n_read_threads segments for
non-ibuf read and write, a third aio array for the ibuf i/o, with just one read, n_write_threads segments for writes, one segment for the ibuf i/o, and
segment, two aio arrays for log reads and writes with one segment, and a one segment for log IO. Returns the number of segments created. When async
synchronous aio array of the specified size. The combined number of segments IO is not used, and 4 threads should be created to process requests put
in the three first aio arrays is the parameter n_segments given to the in the segments. */
function. The caller must create an i/o handler thread for each segment in
the four first arrays, but not for the sync aio array. */
void ulint
os_aio_init( os_aio_init(
/*========*/ /*========*/
ulint n, /* in: maximum number of pending aio operations ulint ios_per_array, /* in: maximum number of pending aio operations
allowed; n must be divisible by n_segments */ allowed per array */
ulint n_segments, /* in: combined number of segments in the four ulint n_read_threads, /* in: number of read threads */
first aio arrays; must be >= 4 */ ulint n_write_threads, /* in: number of write threads */
ulint n_slots_sync); /* in: number of slots in the sync aio array */ ulint n_slots_sync); /* in: number of slots in the sync aio array */
/*********************************************************************** /***********************************************************************
Requests an asynchronous i/o operation. */ Requests an asynchronous i/o operation. */
......
...@@ -90,6 +90,12 @@ extern ulint srv_mem_pool_size; ...@@ -90,6 +90,12 @@ extern ulint srv_mem_pool_size;
extern ulint srv_lock_table_size; extern ulint srv_lock_table_size;
extern ulint srv_n_file_io_threads; extern ulint srv_n_file_io_threads;
/* Number of background IO threads for read and write. Replaces
* srv_n_file_io_threads. */
extern ulint srv_n_read_io_threads;
extern ulint srv_n_write_io_threads;
/* Max number of adjacent IO requests to merge into one large request. */
extern ulint srv_max_merged_io;
#ifdef UNIV_LOG_ARCHIVE #ifdef UNIV_LOG_ARCHIVE
extern ibool srv_log_archive_on; extern ibool srv_log_archive_on;
......
This diff is collapsed.
...@@ -173,6 +173,10 @@ ulint srv_lock_table_size = ULINT_MAX; ...@@ -173,6 +173,10 @@ ulint srv_lock_table_size = ULINT_MAX;
ulint srv_n_file_io_threads = ULINT_MAX; ulint srv_n_file_io_threads = ULINT_MAX;
ulint srv_n_read_io_threads = ULINT_MAX;
ulint srv_n_write_io_threads = ULINT_MAX;
ulint srv_max_merged_io = 64;
#ifdef UNIV_LOG_ARCHIVE #ifdef UNIV_LOG_ARCHIVE
ibool srv_log_archive_on = FALSE; ibool srv_log_archive_on = FALSE;
ibool srv_archive_recovery = 0; ibool srv_archive_recovery = 0;
......
...@@ -985,6 +985,7 @@ innobase_start_or_create_for_mysql(void) ...@@ -985,6 +985,7 @@ innobase_start_or_create_for_mysql(void)
ulint i; ulint i;
ibool srv_file_per_table_original_value = srv_file_per_table; ibool srv_file_per_table_original_value = srv_file_per_table;
mtr_t mtr; mtr_t mtr;
ulint n_threads;
#ifdef HAVE_DARWIN_THREADS #ifdef HAVE_DARWIN_THREADS
# ifdef F_FULLFSYNC # ifdef F_FULLFSYNC
/* This executable has been compiled on Mac OS X 10.3 or later. /* This executable has been compiled on Mac OS X 10.3 or later.
...@@ -1238,26 +1239,34 @@ innobase_start_or_create_for_mysql(void) ...@@ -1238,26 +1239,34 @@ innobase_start_or_create_for_mysql(void)
} }
/* Restrict the maximum number of file i/o threads */ /* Restrict the maximum number of file i/o threads */
if (srv_n_file_io_threads > SRV_MAX_N_IO_THREADS) { if ((srv_n_read_io_threads + srv_n_write_io_threads) > SRV_MAX_N_IO_THREADS) {
fprintf(stderr,
srv_n_file_io_threads = SRV_MAX_N_IO_THREADS; "InnoDB: requested too many read(%d) or write(%d) IO threads, max is %d\n",
srv_n_read_io_threads, srv_n_write_io_threads, SRV_MAX_N_IO_THREADS);
return(DB_ERROR);
} }
if (!os_aio_use_native_aio) { if (!os_aio_use_native_aio) {
/* In simulated aio we currently have use only for 4 threads */ /* More than 4 threads are now supported. */
srv_n_file_io_threads = 4; n_threads = os_aio_init(8 * SRV_N_PENDING_IOS_PER_THREAD,
srv_n_read_io_threads,
os_aio_init(8 * SRV_N_PENDING_IOS_PER_THREAD srv_n_write_io_threads,
* srv_n_file_io_threads,
srv_n_file_io_threads,
SRV_MAX_N_PENDING_SYNC_IOS); SRV_MAX_N_PENDING_SYNC_IOS);
} else { } else {
os_aio_init(SRV_N_PENDING_IOS_PER_THREAD /* Might need more slots here. Alas, I don't do windows. */
* srv_n_file_io_threads, n_threads = os_aio_init(SRV_N_PENDING_IOS_PER_THREAD,
srv_n_file_io_threads, srv_n_read_io_threads,
srv_n_write_io_threads,
SRV_MAX_N_PENDING_SYNC_IOS); SRV_MAX_N_PENDING_SYNC_IOS);
} }
if (n_threads > SRV_MAX_N_IO_THREADS) {
fprintf(stderr,
"InnoDB: requested too many IO threads(%d), max is %d\n",
n_threads, SRV_MAX_N_IO_THREADS);
return(DB_ERROR);
}
fil_init(srv_max_n_open_files); fil_init(srv_max_n_open_files);
if (srv_use_awe) { if (srv_use_awe) {
...@@ -1295,7 +1304,7 @@ innobase_start_or_create_for_mysql(void) ...@@ -1295,7 +1304,7 @@ innobase_start_or_create_for_mysql(void)
/* Create i/o-handler threads: */ /* Create i/o-handler threads: */
for (i = 0; i < srv_n_file_io_threads; i++) { for (i = 0; i < n_threads; i++) {
n[i] = i; n[i] = i;
os_thread_create(io_handler_thread, n + i, thread_ids + i); os_thread_create(io_handler_thread, n + i, thread_ids + i);
......
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