MySQL 5.5


Published on

A look at the features coming up with MySQL 5.5

Published in: Technology
  • Be the first to comment

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide
  • In linked in and twitter
  • bullet 2 - fully synchronous replication means that the master will commit a transaction and *all* the slaves will have to also commit the transaction for the master to return to the session as completed. Think about that - fully synchronous means that the commit must be done - everywhere... that can take a while if a slave is on a slow network. We are stuck waiting for the slowest server for *every* commit. implemented using plugins. only for Linux. Other platforms are is not yet supported.
  • Note: InnoDB has recently added a wealth of information on it’s internal state to the Performance Schema. bullet 6: While the server behavior does not change, for InnoDB it does introduce some performance overhead so be sure to test. Examples of information available: o Mutexes in the MUTEX_INSTANCES table. o RW-locks in the RWLOCK_INSTANCES table. o File I/O operations in the FILE_INSTANCES, FILE_SUMMARY_BY_EVENT_NAME, and FILE_SUMMARY_BY_INSTANCE tables. o Threads in the PROCESSLIST table.
  • if pval = 0 SQLSTATE values that begin with '01 == warning'. warning does not terminate the procedure, and can be seen with SHOW WARNINGS if pval = 1, an error ('45000', which means “unhandled user-defined exception.” ) , sets the MESSAGE_TEXT condition information item. error * terminates* the procedure, and the text is returned with the error information. if pval = 2 SQLSTATE value is specified using a named condition in this case. (DECLARE) A gotcha - SIGNAL/RESIGNAL can only use a CONDITION defined with SQLSTATE - MySQL error number (4 digits) does not count. anything else first signals a warning (SQLSTATE begins with “01”) and sets the message text and error number condition information items. warning does not terminate the procedure, so execution continues then signals an error. error does * terminate* the procedure. message text and error number set by the warning are replaced by the values set by the error, which are returned with the error information.
  • Note: Catch it - do something to it, then rethrow it
  • Easier just to think it rewrites the error
  • Expands on Range, List, Column, Hash and Key Partitioning bullet 2 - supposedly partition pruning works better with these enhancements. bullet 3 - in 5.1 partitioning could only work with integer values. so dates had to be converted with functions Background: RANGE partitioning - assigns rows to partitions based on column values falling within a given range. LIST partitioning - Similar to RANGE , but is selected based on columns matching one of a set of discrete values. HASH partitioning - selected based on the value returned by a user-defined expression that operates on column values in rows to be inserted into the table. The function may consist of any expression valid in MySQL that yields a nonnegative integer value. KEY partitioning - similar to HASH , except that only one or more columns to be evaluated are supplied, and the MySQL server provides its own hashing function. These columns can contain other than integer values, since the hashing function supplied by MySQL guarantees an integer result regardless of the column data type.
  • - similar to RANGE partitioning, but allows you to define partitions using ranges based on multiple column values bullet 2 sub-bullet 2: partitions are based on comparisons between tuples (lists of column values) rather than comparisons between scalar values. Placement of rows in RANGE COLUMNS partitions is also based on comparisons between tuples. bullet 2 sub-bullet 3: string, DATE and DATE TIME col umns can also be used as partitioning columns.
  • - Yes it is kinda Counter intuitive... - The big thing is that you have to think in tuples using the whole value not the individual parts! So (5, 10) is less then (5, 12), and (5, 11) is less then (5, 12). But (5, 12) is not less then (5, 12) - Mathematically: (a < 5) OR ((a = 5) AND ( b < 12))
  • Suppose that you have a business that has customers in 12 cities which, for sales and marketing purposes, you organize into 4 regions of 3 cities each With LIST COLUMNS partitioning, you can create a table for customer data that assigns a row to any of 4 partitions corresponding to these regions based on the name of the city where a customer resides
  • NOTE: InnoDB will be the default storage engine at this point
  • MUTEX Definition: I nformal abbreviation for “mutex variable”. (Mutex itself is short for “mutual exclusion”.) Used to enforce exclusive-access locks to internal in-memory data structures. Once the lock is acquired, any other process, thread, and so on is prevented from acquiring the same lock. Contrast with rw-locks, which allow shared access. Mutexes and rw-locks are known collectively as latches.
  • bullet 2 - leading high-performance memory allocators include Hoard, libumem, mtmalloc, ptmalloc, tbbmalloc, and TCMalloc bullet 3 - especially those where memory is frequently allocated and released (such as multi-table joins) bullet 4 - you control whether InnoDB uses its own memory allocator or an allocator of the operating system - 1.0.3
  • bullet 1: example: applications with a high volume of DML operations such as bulk inserts. sub-bullet 1: when the relevant page is *not* in the buffer pool. This saves on IO since it will not read in the row that is to be changed from disk bullet 2, sub-bullet 2: more data will be held that needs to be purged. This can be mitigated with a more aggressive innodb_max_purge_lag setting and innodb_adaptive_flushing. Also through the purge thread we will discuss a little later. bullet 3: 1.0.3 for inserts, 1.1 for deletes and purges sub-bullet 1: all - The default value: buffer inserts, delete-marking operations, and purges. none - Do not buffer any operations. inserts - Buffer insert operations. deletes - Buffer delete-marking operations. changes - Buffer both inserts and delete-marking. purges - Buffer the physical deletion operations that happen in the background.
  • bullet 1: in anticipation of being needed soon bullet 2: Random was removed since it often resulted in performance degradation. bullet 3: If InnoDB reads at least innodb_read_ahead_threshold pages sequentially from an extent (64 pages), it initiates an asynchronous read for the entire following extent. bullet 3 sub-bullet 1: The default value is 56. bullet 4: smaller ‘evicted’ is to ‘ahead’ the better - Innodb_buffer_pool_read_ahead_evicted - the number of such pages evicted without ever being accessed - Innodb_buffer_pool_read_ahead - the number of pages read in as part of read ahead
  • bullet 1: can become a bottleneck. serialize events and doesn’t take full advantage of multi-core bullet 2: default value for these parameters is 4 and the permissible values range from 1-64. - won't do *any* work on it's own. When other threads submit requests, it helps complete those requests. bullet 3: Each background thread can handle up to 256 pending I/O requests. A major source of background I/O is the read ahead requests. - allows for more parallelism to handle the background IO
  • bullet 1 sub-bullet 2: purge can be moved to its own thread now on the new version. Get into that in a little bit.. bullet 2: not directly related to the background IO threads we discussed earlier
  • Def purge: a type of garbage collection - removes obsolete values from indexes; physically removing rows that were marked for deletion by previous DELETE statements. bullet 1: So we have one thread handling/scheduling multiple operations. Can become overwhelmed since the master thread is also handing flushing the dirty pages
  • Def dirty pages: those pages that have been changed but are not yet written to the database files Def hard check point: flushing the appropriate dirty pages to make space available in the log file bullet 1 sub-bullet 3: problem can occur in a workload that is write intensive and it generates a lot of redo information (writes to the log file). Log file can fill before the dirty_pages_pct is reached. This will cause a hard checkpoint === bad === temporary reduction in throughput while it flushing everything. bullet 2 sub-bullet 2: Internal benchmarking has also shown that this algorithm not only maintains throughput over time, but can also improve overall throughput significantly bullet 2 sub-bullet 3: With it On, it can significantly affect the I/O pattern of a workload. Default is for it to be On.
  • Def spin loop: while waiting for a lock, InnoDB executes a tight loop of instructions repeatedly to avoid having the InnoDB process and threads be rescheduled by the operating system until hopefully the lock becomes available.
  • bullet 1 sub-bullet 1: due to improved algorithms for memory management
  • LRU: Least Recently Used Def innodb_old_blocks_time: Dynamic setting; specifies the time window (in milliseconds) after the first access to a page during which it can be accessed without being moved to the front (most-recently used end) of the LRU list. Default value is 0 corresponding to the original behavior Def innodb_old_blocks_pct: Dynamic setting; controls the percentage of “old” blocks in the LRU list. The default value of innodb_old_blocks_pct is 37, corresponding to the original fixed ratio of 3/8. bullet 1: Without going into details it is possible to push all of the frequently used data out of the buffer pool during large scans (mysqldump, full table scans or large range scans for reports, etc.). This can cause the other/normal/online queries to pushed out of the buffer pool. bullet 2: without going into detail for why it happens (see me later if you really want to know why) there are some new setting to help prevent this from happening * History:Historically, InnoDB has inserted newly read blocks into the middle of the list representing the buffer cache, to avoid pollution of the cache due to excessive read-ahead. The idea is that the read-ahead algorithm should not pollute the buffer cache by forcing the frequently accessed (“hot”) pages out of the LRU list. To achieve this, InnoDB internally maintains a pointer at 3/8 from the tail of the LRU list, and all newly read pages are inserted at this location in the LRU list. The pages are moved to the front of the list (the most-recently used end) when they are accessed from the buffer cache for the *first time*. Thus pages that are never accessed never make it to the front 5/8 of the LRU list.
  • bullet 2: Ex: buffer pool mutex, LRUs bullet 3: uses a hashing function bullet 5: number of buffer pools. 1 (the default) to 64 (the maximum). Takes effect when you set the innodb_buffer_pool_size to a size of 1 gigabyte or more bullet 6: recommend specifying a combination of innodb_buffer_pool_instances and innodb_buffer_pool_size so that each buffer pool instance is a least 1 gigabyte.
  • Note: If you run 5.5.4 on a database, then roll back to some older release, the change still takes effect. bullet 2: - The single rollback segment is divided into 131,072 (128K) segments, - each of which can support up to 1023 transactions that perform writes. - Each transaction is assigned to one of the rollback segments using a hashing function, and remains tied to that rollback segment for the duration . bullet 4 : InnoDB makes the required changes inside the system tablespace automatically, the first time you restart after performing a slow shutdown.
  • Def LSN: log sequence number - an ever-increasing value representing a point in time corresponding to operations recorded in the redo log. It is used internally by InnoDB during crash recovery and for managing the buffer pool. bullet 1: so writing to a log could block access to the pages in the buffer pool that are changed with a mini-transaction commit. These 2 actions have to be scheduled serially. Allows more parallelism. bullet 2: the new log_buf mutex controls writes to buffer pool pages due to mini-transactions.
  • MySQL 5.5

    1. 2. MySQL 5.5 and Scalability <ul><li>Ligaya Turmelle </li></ul><ul><li>Senior Technical Support Engineer - MySQL </li></ul><ul><li>[email_address] </li></ul><ul><li> </li></ul><Insert Picture Here>
    2. 3. The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into any contract. It is not a commitment to deliver any material, code, or functionality, and should not be relied upon in making purchasing decisions. The development, release, and timing of any features or functionality described for Oracle’s products remains at the sole discretion of Oracle.
    3. 4. Areas to Cover <ul><li>Semi-Synchronous Replication </li></ul><ul><li>Performance Schema </li></ul><ul><li>SIGNAL/RESIGNAL </li></ul><ul><li>More Partitioning Options </li></ul><ul><li>InnoDB - LOTS of InnoDB! </li></ul><ul><ul><li>Performance Improvements </li></ul></ul><ul><ul><li>Scalability Improvements </li></ul></ul><Insert Picture Here>
    4. 5. Semi-Synchronous Replication <Insert Picture Here>
    5. 6. History <ul><li>By default is asynchronous </li></ul><ul><ul><li>Master writes to binary log </li></ul></ul><ul><ul><li>Slave connects and “pulls” contents of the binary log </li></ul></ul><ul><li>Master crashes </li></ul><ul><ul><li>No guarantee that a slave has all committed transactions </li></ul></ul><ul><ul><li>Potential lost transactions </li></ul></ul><ul><li>Failover to slave </li></ul><ul><ul><li>May be missing transactions from master </li></ul></ul><ul><ul><li>Loss of data integrity </li></ul></ul>
    6. 7. What is Semi-Synchronous Replication? <ul><li>Alternative to asynchronous replication </li></ul><ul><li>Midway point between asynchronous and fully synchronous </li></ul><ul><li>Doesn’t have to wait for all the slaves to *receive* the event </li></ul><ul><ul><li>The master blocks, waiting for a single slave to acknowledge the commit or timeout </li></ul></ul><ul><li>Doesn’t have to wait for all slaves to *commit* the transaction </li></ul><ul><ul><li>The slave acknowledges after it receives all the events for the transaction, write it to its relay logs, and flush to disk </li></ul></ul><ul><li>Provides improved data integrity at the cost of performance </li></ul>
    7. 8. How does it works <ul><li>Best Case </li></ul><ul><ul><li>COMMIT </li></ul></ul><ul><ul><li>Master blocks waiting for acknowledgment </li></ul></ul><ul><ul><li>On acknowledgement the master returns to the session </li></ul></ul><ul><li>Worst Case </li></ul><ul><ul><li>COMMIT </li></ul></ul><ul><ul><li>Master blocks </li></ul></ul><ul><ul><li>Timeout </li></ul></ul><ul><ul><li>Master reverts to asynchronous mode until at least one semi-synchronous slave catches up </li></ul></ul><ul><ul><li>Revert back to semi-sychronous mode </li></ul></ul>
    8. 9. Performance Schema <Insert Picture Here>
    9. 10. Basic Info <ul><li>Monitoring MySQL Server execution at a *very* low level. </li></ul><ul><ul><li>Used to inspect internal execution of the server at run time </li></ul></ul><ul><li>Focuses on performance data </li></ul><ul><li>Uses the Performance Schema storage engine and the Performance_Schema database </li></ul><ul><li>Tables in Performance_Schema are views or temporary tables. </li></ul><ul><li>Available on all platforms but some limitations might apply </li></ul><ul><li>Activation causes no change in server behavior </li></ul><ul><li>Average user has no need to mess with it - designed for advanced users </li></ul>
    10. 11. SIGNAL/RESIGNAL <Insert Picture Here>
    11. 12. SIGNAL <ul><li>Way to “return” an error. </li></ul><ul><li>AKA exception-handling logic for stored procedures, stored functions, triggers, events, and database applications - think throw </li></ul><ul><li>Allows you to control error number, SQLSTATE value, message </li></ul><ul><li>Can indicate errors, warnings, or “not found.” </li></ul><ul><li>Requires no special permissions </li></ul>
    12. 13. CREATE PROCEDURE p (pval INT) BEGIN DECLARE specialty CONDITION FOR SQLSTATE '45000'; IF pval = 0 THEN SIGNAL SQLSTATE '01000'; ELSEIF pval = 1 THEN SIGNAL SQLSTATE '45000' SET MESSAGE_TEXT = 'An error occurred'; ELSEIF pval = 2 THEN SIGNAL specialty SET MESSAGE_TEXT = 'An error occurred'; ELSE SIGNAL SQLSTATE '01000' SET MESSAGE_TEXT = 'A warning occurred', MYSQL_ERRNO = 1000; SIGNAL SQLSTATE '45000' SET MESSAGE_TEXT = 'An error occurred', MYSQL_ERRNO = 1001; END IF; END;
    13. 14. RESIGNAL <ul><li>passes on error condition information available during execution of a handler. </li></ul><ul><li>Requires an active handler to execute </li></ul><ul><li>Possible to both handle an error and return the error information. Think catch/throw block. </li></ul><ul><li>May change some or all information before passing it on. </li></ul><ul><li>No special permissions needed to use </li></ul><ul><li>Multiple possible uses </li></ul><ul><ul><li>Alone </li></ul></ul><ul><ul><li>With new signal information </li></ul></ul><ul><ul><li>With a condition value and possibly new signal information </li></ul></ul><ul><li>Otherwise follows the rules of SIGNAL </li></ul>
    14. 15. RESIGNAL alone <ul><li>Pass on error with no change </li></ul><ul><li>Allows for the performance of additional actions in the active handler, and then passing on the error message without changing the original condition information </li></ul>CREATE PROCEDURE p () BEGIN DECLARE EXIT HANDLER FOR SQLEXCEPTION BEGIN SET @error_count = @error_count + 1; IF @a = 0 THEN RESIGNAL; END IF; END; DROP TABLE xx; END
    15. 16. RESIGNAL with New Signal Information <ul><li>Pass on error with changes </li></ul><ul><li>Allows for the performance of additional actions in the active handler, and can change any or all of the signal information items </li></ul>CREATE PROCEDURE p () BEGIN DECLARE EXIT HANDLER FOR SQLEXCEPTION BEGIN SET @error_count = @error_count + 1; IF @a = 0 THEN RESIGNAL SET MYSQL_ERRNO = 5; END IF; END; DROP TABLE xx; END
    16. 17. RESIGNAL with a Condition Value and Possibly New Signal Information <ul><li>Push a new “condition” into the current error stack </li></ul><ul><li>Similar effects of previous example, except instead of rewriting the signal information it adds a new signal to the top of the error stack </li></ul>CREATE PROCEDURE p () BEGIN DECLARE EXIT HANDLER FOR SQLEXCEPTION BEGIN SET @error_count = @error_count + 1; IF @a = 0 THEN RESIGNAL SQLSTATE '45000' SET MYSQL_ERRNO=5; END IF; END; DROP TABLE xx; END
    17. 18. Column Partitioning Options <Insert Picture Here>
    18. 19. Column Partitioning <ul><li>Variants on RANGE and LIST partitioning </li></ul><ul><ul><li>RANGE COLUMNS </li></ul></ul><ul><ul><li>LIST COLUMNS </li></ul></ul><ul><li>Allows the use of multiple columns in partitioning keys </li></ul><ul><ul><li>All columns taken into account </li></ul></ul><ul><ul><ul><li>for placing rows in partitions </li></ul></ul></ul><ul><ul><ul><li>for use in partition pruning. </li></ul></ul></ul><ul><li>Support the use of non-integer columns </li></ul><ul><ul><li>All integer types </li></ul></ul><ul><ul><li>DATE and DATETIME </li></ul></ul><ul><ul><li>CHAR , VARCHAR , BINARY , and VARBINARY </li></ul></ul><ul><li>Great article at </li></ul>
    19. 20. Range Column <ul><li>Allows for multiple column values </li></ul><ul><li>Major differences from just RANGE </li></ul><ul><ul><li>Does not accept expressions, only names of columns </li></ul></ul><ul><ul><li>Accepts a list of one or more columns </li></ul></ul><ul><ul><li>Not restricted to integer columns </li></ul></ul><ul><li>Go to the example </li></ul>
    20. 21. CREATE TABLE rc1 (a INT, b INT) PARTITION BY RANGE COLUMNS(a, b) ( PARTITION p0 VALUES LESS THAN (5, 12), PARTITION p3 VALUES LESS THAN (MAXVALUE, MAXVALUE) ); mysql> INSERT INTO rc1 VALUES (5,10), (5,11), (5,12); Query OK, 3 rows affected (0.00 sec) Records: 3 Duplicates: 0 Warnings: 0 mysql> SELECT PARTITION_NAME,TABLE_ROWS -> FROM INFORMATION_SCHEMA.PARTITIONS -> WHERE TABLE_NAME = 'rc1'; +--------------+----------------+------------+ | TABLE_SCHEMA | PARTITION_NAME | TABLE_ROWS | +--------------+----------------+------------+ | p | p0 | 2 | | p | p1 | 1 | +--------------+----------------+------------+
    21. 22. List Column <ul><li>Again allows for multiple column values </li></ul><ul><li>Allows you to use </li></ul><ul><ul><li>string types </li></ul></ul><ul><ul><li>DATE , </li></ul></ul><ul><ul><li>DATETIME </li></ul></ul><ul><li>Do not need to convert values to integers to work with </li></ul><ul><li>Much easier to read </li></ul><ul><li>Go to the example </li></ul>
    22. 23. CREATE TABLE customers_1 ( first_name VARCHAR(25), last_name VARCHAR(25), street_1 VARCHAR(30), city VARCHAR(15), renewal DATE ) PARTITION BY LIST COLUMNS(city) ( PARTITION NorthEast VALUES IN('Boston', 'New York', 'Providence'), PARTITION South VALUES IN('Miami', 'Atlanta', 'New Orleans'), PARTITION MidWest VALUES IN('Chicago', 'Houston', 'Denver'), PARTITION West VALUES IN('Los Angeles', 'San Francisco', 'Seattle') );
    23. 24. InnoDB <Insert Picture Here>
    24. 25. System Mutex Library <ul><li>Originally used its own implementation of mutexes and read/write locks with Pthreads </li></ul><ul><li>From 1.0.3, changed to the GNU Compiler Collection (GCC) for atomic memory access instead of using the Pthreads approach previously used. </li></ul><ul><li>Faster more efficient locking </li></ul><ul><li>Greater scalability on multi-core platforms. </li></ul><ul><li>Enabled out of the box on platforms where supported </li></ul><ul><li>Freebie </li></ul>
    25. 26. Memory Allocator <ul><li>History: </li></ul><ul><ul><li>Originally built its own and protected by a single mutex </li></ul></ul><ul><ul><li>Also included a wrapper around the system allocator (malloc and free) </li></ul></ul><ul><ul><ul><li>also protected with a single mutex </li></ul></ul></ul><ul><ul><li>All bad for multi-core computers </li></ul></ul><ul><li>Great improvements have occurred since then </li></ul><ul><ul><li>Perform better and are more scalable than they were in the past </li></ul></ul><ul><li>Most workloads benefit from using the new schedulers. </li></ul><ul><li>innodb_use_sys_malloc </li></ul>
    26. 27. Change Buffer <ul><li>Most relevant to IO bound systems </li></ul><ul><ul><li>Will cache changes to secondary index entries </li></ul></ul><ul><ul><li>Can buffer inserts, delete-marking operations, and purges </li></ul></ul><ul><li>But... </li></ul><ul><ul><li>Resides in buffer pool - reducing memory to cache data </li></ul></ul><ul><ul><li>Increases risk of a purge hold </li></ul></ul><ul><li>Can control whether InnoDB performs this buffering using innodb_change_buffering. </li></ul><ul><ul><li>Multiple values available to buffer only what you want </li></ul></ul>
    27. 28. Read Ahead <ul><li>Prefetch multiple pages in the buffer cache asynchronously </li></ul><ul><li>Only the Linear algorithm now </li></ul><ul><ul><li>Based on access pattern of pages, not just their number </li></ul></ul><ul><li>Can now control when InnoDB performs a read-ahead operation with innodb_read_ahead_threshold </li></ul><ul><ul><li>Higher the value, the more strict the access pattern </li></ul></ul><ul><li>Efficiency can be found with Innodb_buffer_pool_read_ahead_evicted < Innodb_buffer_pool_read_ahead </li></ul>
    28. 29. Background IO Threads <ul><li>History </li></ul><ul><ul><li>1 read, 1 write, 1 log, 1 insert buffer (non-Windows) </li></ul></ul><ul><ul><li>Windows used innodb_file_io_threads (deprecated) </li></ul></ul><ul><li>Now configurable </li></ul><ul><ul><li>Number of background *helper* threads tasked with servicing any read and write I/O on the data pages </li></ul></ul><ul><li>Makes InnoDB more scalable on high end systems </li></ul>
    29. 30. INNODB_IO_CAPACITY <ul><li>Controls the IO capacity of the InnoDB Master thread. </li></ul><ul><ul><li>It controls how many dirty pages are flushed and the size of the ibuf contraction </li></ul></ul><ul><ul><li>Also handles the purge but... </li></ul></ul><ul><li>Should be set to approximately the number of I/O operations that the system can perform per second </li></ul>
    30. 31. Improved Purge Scheduling <ul><li>History </li></ul><ul><ul><li>One of the operations handled by the Master Thread </li></ul></ul><ul><li>Now moved to its own thread </li></ul><ul><ul><li>separates main database operations from maintenance work happening in the background. </li></ul></ul><ul><li>Improves scalability </li></ul><ul><li>May not see improvement on speed since it may hit new types of contention </li></ul><ul><ul><li>lays groundwork for further tuning and potentially more then one purge thread. </li></ul></ul><ul><li>Enable with innodb_purge_threads=1 </li></ul>
    31. 32. Adaptive Dirty Page Flushing <ul><li>History </li></ul><ul><ul><li>Performed in background </li></ul></ul><ul><ul><li>Performed by master thread </li></ul></ul><ul><ul><li>Currently will aggressively flush buffer pool pages if innodb_max_dirty_pages_pct percentage exceeded </li></ul></ul><ul><li>New algorithm </li></ul><ul><ul><li>Intent is to smooth overall performance, eliminating steep dips in throughput </li></ul></ul><ul><ul><li>Function of the number of dirty pages in the buffer cache and the rate at which redo is being generated </li></ul></ul><ul><ul><ul><li>self adapting to sudden changes in workload </li></ul></ul></ul><ul><ul><ul><li>better performance </li></ul></ul></ul><ul><ul><li>Turn on and off with innodb_adaptive_flushing </li></ul></ul>
    32. 33. PAUSE in spin loops <ul><li>Most people won’t care about this </li></ul><ul><li>But... if you are CPU bound - you will </li></ul><ul><ul><li>Increases overall performance with CPU-bound workloads </li></ul></ul><ul><ul><li>Added benefit of minimizing power consumption during the execution of the spin loops. </li></ul></ul><ul><li>Ugly details: </li></ul><ul><ul><li>If the spin loops are executed too quickly, system resources are wasted, imposing a relatively severe penalty on transaction throughput </li></ul></ul><ul><ul><li>Uses a PAUSE instruction in its spin loops on all platforms where such an instruction is available. </li></ul></ul><ul><li>Nothing needs to be done to take advantage of this </li></ul>
    33. 34. Faster Recovery <ul><li>A number of optimizations speed up certain steps of the recovery that happens on the next startup after a crash. </li></ul><ul><ul><li>Particularly scanning the redo log and applying the redo log are faster. </li></ul></ul><ul><li>If you kept the size of your logfiles artificially low because recovery took a long time (1 hour to 1 day), you can consider increasing the logfile size. </li></ul><ul><li>No action needed to get this </li></ul>
    34. 35. Buffer Cache - Scan Resistant <ul><li>Problem: with large scans it is possible to move all your “hot” data out of the buffer pool. </li></ul><ul><ul><li>More IO loading the hot data back into the buffer pool </li></ul></ul><ul><ul><li>Slow response times </li></ul></ul><ul><li>How to prevent it: </li></ul><ul><ul><li>Mixed OLTP type with periodic batch reporting queries which result in large scans </li></ul></ul><ul><ul><ul><li>set innodb_old_blocks_time for the duration of the batch run </li></ul></ul></ul><ul><ul><li>Scanning large tables that cannot fit entirely in the buffer pool </li></ul></ul><ul><ul><ul><li>set innodb_old_blocks_pct to a small value </li></ul></ul></ul><ul><li>Always benchmark to verify the effectiveness </li></ul>
    35. 36. Multiple Buffer Pools <ul><li>Primarily useful for people with a large buffer pool size </li></ul><ul><li>Reduce the chances of encountering bottlenecks trying to access the same buffer pool </li></ul><ul><li>Pages are stored in or read from random buffer pools </li></ul><ul><li>Each buffer pool manages its own internal structures and is protected by its own buffer pool mutex </li></ul><ul><li>innodb_buffer_pool_instances </li></ul><ul><li>innodb_buffer_pool_size is divided up among all the buffer pools </li></ul>
    36. 37. Multiple Rollback Segments <ul><li>History: </li></ul><ul><ul><li>A bottleneck on high-capacity systems - currently it can handle a maximum of 1023 concurrent transactions that change any data </li></ul></ul><ul><li>Limit on concurrent transactions is greatly expanded </li></ul><ul><li>Improves </li></ul><ul><ul><li>Scalability - higher number of concurrent transactions </li></ul></ul><ul><ul><li>Performance - less contention when different threads access the rollback segments </li></ul></ul><ul><li>To enable </li></ul><ul><ul><li>Do a slow shutdown (innodb_fast_shutdown=0) before upgrading </li></ul></ul>
    37. 38. Log Sys Mutex <ul><li>Historically did double duty: </li></ul><ul><ul><li>Controlled access to internal data structures related to log records and the LSN </li></ul></ul><ul><ul><li>Controlled access to pages in the buffer pool that are changed when a mini-transaction is committed. </li></ul></ul><ul><li>Now broken out into separate mutexs </li></ul><ul><li>Improves performance </li></ul><ul><li>Nothing to enable - it is free </li></ul>
    38. 39. Questions?