-
Notifications
You must be signed in to change notification settings - Fork 714
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Waste less memory on os_event structs
Summary: WebScaleSQL Feature: Lower Memory Footprint This fixes: http://bugs.mysql.com/62535 Allow os_event structs to be packed into their parent structures. Split memory-management linked-list overhead out of event struct. Don't allocate linked-list overhead when it won't be used (when packed). Packed event structures into mutex and rw_lock structures. Adjust event and fast_mutex counts on exit, since rw_locks are never freed. Trimmed down some wasted space within the event strutures. Added macros to access sub-elements in optimized packed values. Share the pthread mutex and condvar data in a pool for packed events. Still allocate dedicated pthread data for each non-packed os_event_t. Added innodb_sync_pool_size sysvar to select pool size (def: 1024). Memory usage test results (with 54G buffer pool, from 5.6.10): 61510268 KB - Without this change 60266124 KB - With this change Space savings ~ 1.2 GB Sysbench results (from 5.6.10): QPS for 24 cores, 22G database, 1G buffer pool, read-only: 8 16 32 64 128 256 threads 51253 100571 164190 165912 159370 170362 without this change 51717 103426 166108 168247 159133 172756 with this change Test Plan: Passed all unit tests, including the big and huge stress tests. Reviewers: darnaut, inaam-rana, jeremycole, pivanof Reviewed By: pivanof Subscribers: jtolmer Differential Revision: https://reviews.facebook.net/D24165 Differential Revision: https://reviews.facebook.net/D54465
- Loading branch information
1 parent
19dc9fa
commit c1b8d83
Showing
14 changed files
with
402 additions
and
103 deletions.
There are no files selected for viewing
53 changes: 53 additions & 0 deletions
53
mysql-test/suite/sys_vars/r/innodb_sync_pool_size_basic.result
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
'#---------------------BS_STVARS_022_01----------------------#' | ||
SELECT @@GLOBAL.innodb_sync_pool_size; | ||
@@GLOBAL.innodb_sync_pool_size | ||
1024 | ||
1024 Expected | ||
'#---------------------BS_STVARS_022_02----------------------#' | ||
SET @@GLOBAL.innodb_sync_pool_size=1; | ||
ERROR HY000: Variable 'innodb_sync_pool_size' is a read only variable | ||
Expected error 'Read only variable' | ||
SELECT @@GLOBAL.innodb_sync_pool_size; | ||
@@GLOBAL.innodb_sync_pool_size | ||
1024 | ||
1024 Expected | ||
'#---------------------BS_STVARS_022_03----------------------#' | ||
SELECT @@GLOBAL.innodb_sync_pool_size = VARIABLE_VALUE | ||
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES | ||
WHERE VARIABLE_NAME='innodb_sync_pool_size'; | ||
@@GLOBAL.innodb_sync_pool_size = VARIABLE_VALUE | ||
1 | ||
1 Expected | ||
SELECT @@GLOBAL.innodb_sync_pool_size; | ||
@@GLOBAL.innodb_sync_pool_size | ||
1024 | ||
1024 Expected | ||
SELECT VARIABLE_VALUE | ||
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES | ||
WHERE VARIABLE_NAME='innodb_sync_pool_size'; | ||
VARIABLE_VALUE | ||
1024 | ||
1024 Expected | ||
'#---------------------BS_STVARS_022_04----------------------#' | ||
SELECT @@innodb_sync_pool_size = @@GLOBAL.innodb_sync_pool_size; | ||
@@innodb_sync_pool_size = @@GLOBAL.innodb_sync_pool_size | ||
1 | ||
1 Expected | ||
'#---------------------BS_STVARS_022_05----------------------#' | ||
SELECT @@innodb_sync_pool_size; | ||
@@innodb_sync_pool_size | ||
1024 | ||
1024 Expected | ||
SELECT @@local.innodb_sync_pool_size; | ||
ERROR HY000: Variable 'innodb_sync_pool_size' is a GLOBAL variable | ||
Expected error 'Variable is a GLOBAL variable' | ||
SELECT @@SESSION.innodb_sync_pool_size; | ||
ERROR HY000: Variable 'innodb_sync_pool_size' is a GLOBAL variable | ||
Expected error 'Variable is a GLOBAL variable' | ||
SELECT @@GLOBAL.innodb_sync_pool_size; | ||
@@GLOBAL.innodb_sync_pool_size | ||
1024 | ||
1024 Expected | ||
SELECT innodb_sync_pool_size = @@SESSION.innodb_sync_pool_size; | ||
ERROR 42S22: Unknown column 'innodb_sync_pool_size' in 'field list' | ||
Expected error 'Unknown column' |
93 changes: 93 additions & 0 deletions
93
mysql-test/suite/sys_vars/t/innodb_sync_pool_size_basic.test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
################## mysql-test\t\innodb_sync_pool_size_basic.test ############## | ||
# # | ||
# Variable Name: innodb_sync_pool_size # | ||
# Scope: Global # | ||
# Access Type: Static # | ||
# Data Type: numeric # | ||
# # | ||
# # | ||
# Creation Date: 2012-02-27 # | ||
# Author : Steaphan Greene # | ||
# # | ||
# # | ||
# Description: Test Cases of Dynamic System Variable innodb_sync_pool_size # | ||
# that checks the behavior of this variable. # | ||
# # | ||
############################################################################### | ||
|
||
--source include/have_innodb.inc | ||
|
||
--echo '#---------------------BS_STVARS_022_01----------------------#' | ||
#################################################################### | ||
# Displaying default value # | ||
#################################################################### | ||
SELECT @@GLOBAL.innodb_sync_pool_size; | ||
--echo 1024 Expected | ||
|
||
|
||
--echo '#---------------------BS_STVARS_022_02----------------------#' | ||
#################################################################### | ||
# Check if Value can set # | ||
#################################################################### | ||
|
||
--error ER_INCORRECT_GLOBAL_LOCAL_VAR | ||
SET @@GLOBAL.innodb_sync_pool_size=1; | ||
--echo Expected error 'Read only variable' | ||
|
||
SELECT @@GLOBAL.innodb_sync_pool_size; | ||
--echo 1024 Expected | ||
|
||
|
||
|
||
|
||
--echo '#---------------------BS_STVARS_022_03----------------------#' | ||
################################################################# | ||
# Check if the value in GLOBAL Table matches value in variable # | ||
################################################################# | ||
|
||
SELECT @@GLOBAL.innodb_sync_pool_size = VARIABLE_VALUE | ||
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES | ||
WHERE VARIABLE_NAME='innodb_sync_pool_size'; | ||
--echo 1 Expected | ||
|
||
SELECT @@GLOBAL.innodb_sync_pool_size; | ||
--echo 1024 Expected | ||
|
||
SELECT VARIABLE_VALUE | ||
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES | ||
WHERE VARIABLE_NAME='innodb_sync_pool_size'; | ||
--echo 1024 Expected | ||
|
||
|
||
|
||
--echo '#---------------------BS_STVARS_022_04----------------------#' | ||
################################################################################ | ||
# Check if accessing variable with and without GLOBAL point to same variable # | ||
################################################################################ | ||
SELECT @@innodb_sync_pool_size = @@GLOBAL.innodb_sync_pool_size; | ||
--echo 1 Expected | ||
|
||
|
||
|
||
--echo '#---------------------BS_STVARS_022_05----------------------#' | ||
################################################################################ | ||
# Check if innodb_sync_pool_size can be accessed with and without @@ sign # | ||
################################################################################ | ||
|
||
SELECT @@innodb_sync_pool_size; | ||
--echo 1024 Expected | ||
|
||
--Error ER_INCORRECT_GLOBAL_LOCAL_VAR | ||
SELECT @@local.innodb_sync_pool_size; | ||
--echo Expected error 'Variable is a GLOBAL variable' | ||
|
||
--Error ER_INCORRECT_GLOBAL_LOCAL_VAR | ||
SELECT @@SESSION.innodb_sync_pool_size; | ||
--echo Expected error 'Variable is a GLOBAL variable' | ||
|
||
SELECT @@GLOBAL.innodb_sync_pool_size; | ||
--echo 1024 Expected | ||
|
||
--Error ER_BAD_FIELD_ERROR | ||
SELECT innodb_sync_pool_size = @@SESSION.innodb_sync_pool_size; | ||
--echo Expected error 'Unknown column' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.