innodb performance and usability patches

Download InnoDB Performance and Usability Patches

Post on 31-Jan-2016

20 views

Category:

Documents

0 download

Embed Size (px)

DESCRIPTION

InnoDB Performance and Usability Patches. MySQL CE 2009 Vadim Tkachenko, Ewen Fortune Percona Inc MySQLPerformanceBlog.com. Who are we ?. Vadim Tkachenko Co-Founder of Percona Inc Lead of R&D department Co-Author MySQLPerformanceBlog.com - PowerPoint PPT Presentation

TRANSCRIPT

  • InnoDB Performance and Usability PatchesMySQL CE 2009

    Vadim Tkachenko,Ewen Fortune

    Percona IncMySQLPerformanceBlog.com

  • Who are we ?Vadim TkachenkoCo-Founder of Percona IncLead of R&D departmentCo-Author MySQLPerformanceBlog.comCo-Author High Performance MySQL 2nd edition bookEwen FortuneConsultant, Percona IncSpecial Thanks Yasufumi KinoshitaNot here, but author of most patchesInnoDB Performance and Usability Patches-*-

    InnoDB Performance and Usability Patches

  • What is this talk about?Patches made by Percona for InnoDB Storage EngineTwo main focusesPerformance improvement patchesUsability patchesMake InnoDB a bit more friendly World changed since time of Pentium 100MHz and 8MB of RAMBut many such assumptions still in InnoDB codeInnoDB Performance and Usability Patches-*-

    InnoDB Performance and Usability Patches

  • Why we do itMost requirements and changes come from practical work with customersWe need InnoDB fully utilizing modern hardware today16 coresRAIDsSSD / FusionIO / other storage technologiesInnoDB team is conservative in making improvements in this area

    InnoDB Performance and Usability Patches-*-

    InnoDB Performance and Usability Patches

  • FutureWhy patches ? Why it cant be included in InnoDB?We are often asked about, but actually question is to InnoDB team(empty space due to uncertainty of MySQL future in Oracle)

    Anyway we will continue our workInnoDB Performance and Usability Patches-*-

    InnoDB Performance and Usability Patches

  • Versions5.0Set of patchesSHOW PATCHES to see full list5.1Storage engine XtraDBBased on InnoDB + patches, not real competitor of InnoDB, but drop-in enhanced versionInnoDB Performance and Usability Patches-*-

    InnoDB Performance and Usability Patches

  • Performance PatchesInnoDB Performance and Usability Patches-*-

    InnoDB Performance and Usability Patches

  • ScalabilityEnhanced read_write locksImproves InnoDB scalability on systems with 8-16 cores Similar on Google implementation, InnoDB-plugin-1.0.3Our implementation is alternativeTopic to research which one is betterInnoDB-plugin may be preferred, InnoDB team made hard job porting it to many platformsAnd now in 5.4Split buffer_pool mutex even moreAdditional split of buffer_pool mutex to 5.0.33InnoDB Performance and Usability Patches-*-

    InnoDB Performance and Usability Patches

  • IO patchesInnoDB IO patchesPart similar to Googles InnoDB IO patches, but again alternative Several parts some of them now in 5.4InnoDB Performance and Usability Patches-*-

    InnoDB Performance and Usability Patches

  • IO multiple threadsRead_io_threadsNumber of threads for reads requests (by default 1)Not really useful as used only for read-ahead requestsWrite_io_threadsNumber of threads for write requests (by default 1)This is one you may want to use on system with multiple disksIo_capacityAmount of IO operations per second InnoDB assumes server can do (by default 100, which is not right assumptions for modern systems)InnoDB Performance and Usability Patches-*-

    InnoDB Performance and Usability Patches

  • IO Adaptive checkpointInnoDB flushing of dirty buffer_pool pages may be intensiveLack of free pages may be controlled by innodb_max_dirty_pages_pctFlushing at the moment of checkpoint is not controllable, intensive and may hurtInnoDB Performance and Usability Patches-*-

    InnoDB Performance and Usability Patches

  • Adaptive checkpointingInnoDB Performance and Usability Patches-*-InnoDB default behavior, hiccups during buffer_pool flushing

    InnoDB Performance and Usability Patches

  • Adaptive checkpointWhat we do:Flush pages more intensivethe closer checkpoint the more intensiveInnoDB Performance and Usability Patches-*-

    InnoDB Performance and Usability Patches

  • Adaptive_checkpointAdaptive_checkpoint=1InnoDB Performance and Usability Patches-*-

    InnoDB Performance and Usability Patches

  • IO Control of Insert bufferIbuf_max_size maximal size of insert buffer (by default can be half of buffer_pool)Ibuf_accel_rate IO rate for background thread, works in pair with io_capacity

    InnoDB Performance and Usability Patches-*-

    InnoDB Performance and Usability Patches

  • IO multiple pagesRead_ahead = (both | linear | random)Control to use or not internal InnoDB read-ahead logicFlush_neighbor_pages = (yes|no)By default InnoDB also writes neighborhoods of flushing pagesAll these operations were made for disks with expensive (in time sense) random reads may be not needed for SSD / FusionIO / other devices with cheap random readsInnoDB Performance and Usability Patches-*-

    InnoDB Performance and Usability Patches

  • Extra rollback segmentsBy default InnoDB uses single segment protected by mutexSensitive in intensive parallel insert load

    InnoDB Performance and Usability Patches-*-

    InnoDB Performance and Usability Patches

  • Fix group commitBroken in 5.0Problem appears on slow disks with enabled binary-logs

    InnoDB Performance and Usability Patches-*-

    InnoDB Performance and Usability Patches

  • BenchmarkTpcc-like workload100 Warehouses (about 10GB of data)Buffer_pool=5GBSystem: Dell PowerEdge R900, RAID 10 on 8 disks, RAM 32GBO_DIRECT for InnoDB, xfs filesystem, mounted with nobarrier5.0.77 vs 5.0.77-perconaHad no chance to test 5.4 yetInnoDB Performance and Usability Patches-*-

    InnoDB Performance and Usability Patches

  • BenchmarkInnoDB Performance and Usability Patches-*-

    InnoDB Performance and Usability Patches

    Chart1

    1487.81495.7

    6711.66559

    8252.19471.8

    7128.411302.1

    6527.110935.6

    6210.610013.3

    5767.69567.9

    3931.98244.2

    5.0.77

    5.0.77-percona

    threads

    TpcM

    Sheet1

    Column15.0.775.0.77-percona

    11487.81495.7

    46711.66559

    88252.19471.8

    167128.411302.1

    326527.110935.6

    646210.610013.3

    1285767.69567.9

    2563931.98244.2

    To resize chart data range, drag lower right corner of range.

  • Usability patchesInnoDB Performance and Usability Patches-*-

    InnoDB Performance and Usability Patches

  • MicroslowInnoDB partInnoDB Performance and Usability Patches-*-InnoDB_IO_r_ops: 1 InnoDB_IO_r_bytes: 16384 InnoDB_IO_r_wait: 0.028487 # InnoDB_rec_lock_wait: 0.000000 InnoDB_queue_wait: 0.000000 # InnoDB_pages_distinct: 5

    InnoDB Performance and Usability Patches

  • Limit data dictionaryProblem:Data dictionary entry of once opened table kept in memory forever (or while DELETE table)Is not problem for regular usage (100-1000 tables)Is problem for instances with 10K+ tables10GB+ of memory just allocated for datadictionary entriesOur solution:LRU based datadictionary entriesRemove from memory oldest entries if limit reachedInnoDB Performance and Usability Patches-*-

    InnoDB Performance and Usability Patches

  • IO access patternInnoDB Performance and Usability Patches-*-mysql> select INDEX_ID,TABLE_NAME,INDEX_NAME,sum(N_READ),sum(N_WRITE) from INFORMATION_SCHEMA.INNODB_ALL_PAGE_IO groupby INDEX_ID; +------------+------------------+-------------------+-------------+--------------+| INDEX_ID | TABLE_NAME | INDEX_NAME | sum(N_READ) | sum(N_WRITE) |+------------+------------------+-------------------+-------------+--------------+| 30 | tpcc/item | PRIMARY | 547 | 0 || 32 | tpcc/district | PRIMARY | 1 | 1 || 36 | tpcc/history | GEN_CLUST_INDEX | 11 | 5 || 37 | tpcc/history | fkey_history_1 | 166 | 163 || 38 | tpcc/history | fkey_history_2 | 37 | 30 || 39 | tpcc/new_orders | PRIMARY | 76 | 76 || 43 | tpcc/order_line | PRIMARY | 218 | 189 || 44 | tpcc/order_line | fkey_order_line_2 | 1040 | 1040 || 46 | tpcc/stock | PRIMARY | 3137 | 1764 || 47 | tpcc/stock | fkey_stock_2 | 269 | 0 || 48 | tpcc/customer | PRIMARY | 960 | 580 || 49 | tpcc/customer | idx_customer | 171 | 0 || 50 | tpcc/orders | PRIMARY | 94 | 70 || 51 | tpcc/orders | idx_orders | 142 | 129 |Show pattern of pages on disk accessed

    InnoDB Performance and Usability Patches

  • Show buffer pool contentWhat is in buffer_pool

    InnoDB Performance and Usability Patches-*-select space,offset, RECORDS, DATASIZE, INDEX_NAME,TABLE_SCHEMA,TABLE_NAME from information_schema.INNODB_BUFFER_POOL_CONTENT limit 10;+-------+---------+---------+----------+------------+--------------+-------------+| space | offset | RECORDS | DATASIZE | INDEX_NAME | TABLE_SCHEMA | TABLE_NAME |+-------+---------+---------+----------+------------+--------------+-------------+| 1584 | 640643 | 9 | 10312 | PRIMARY | art104 | article104 | | 1648 | 2100 | 135 | 15226 | PRIMARY | art114 | author114 | | 1492 | 4507 | 158 | 15130 | PRIMARY | art87 | author87 | | 1406 | 17498 | 141 | 16056 | img_status | art52 | img_out52 | | 1466 | 47632 | 49 | 15140 | PRIMARY | art62 | img_out62 | | 1470 | 1395457 | 24 | 14769 | PRIMARY | art84 | article84 | | 1460 | 16025 | 62 | 15174 | PRIMARY | art61 | img_out61 | | 1458 | 560956 | 20 | 14977 | PRIMARY | art61 | article61 | | 1