当前位置:七道奇文章资讯数据防范MySQL防范
日期:2012-04-13 16:45:00  来源:本站整理

关于INNODB存储引擎体系构造简析[MySQL防范]

赞助商链接



  本文“关于INNODB存储引擎体系构造简析[MySQL防范]”是由七道奇为您精心收集,来源于网络转载,文章版权归文章作者所有,本站不对其观点以及内容做任何评价,请读者自行判断,以下是其具体内容:

  一,后台进程

  INNODB存储引擎 由4个I/O线程,1个master线程,1个锁监控线程,以1个错误监控线程.

  下面阐明innodb_file_io_threads参数值为8,系统默许值为4,实际表明在linux下改正innodb_file_io_threads参数值无效.在innodb plugin中,不在利用innodb_file_io_threads参数,而利用innodb_read_io_threads and innodb_write_io_threads 两个值替换. www.110hack.com

  //mysql5.1.50

  root@test 17:54>select version();

  +------------+

  | version() |

  +------------+

  | 5.1.50-log |

  +------------+

  root@test 17:54>show variables like 'innodb_file_io_threads';

  +------------------------+-------+

  | Variable_name | Value |

  +------------------------+-------+

  | innodb_file_io_threads | 8 |

  +------------------------+-------+

  //查看引擎状况

  root@test 17:56>show engine innodb status\G;

  FILE显示的关于IO线程部份

  --------

  FILE I/O

  --------

  I/O thread 0 state: waiting for i/o request (insert buffer thread)

  I/O thread 1 state: waiting for i/o request (log thread)

  I/O thread 2 state: waiting for i/o request (read thread)

  I/O thread 3 state: waiting for i/o request (write thread)

  Pending normal aio reads: 0, aio writes: 0, www.110hack.com

  ibuf aio reads: 0, log i/o's: 0, sync i/o's: 0

  Pending flushes (fsync) log: 0; buffer pool: 0

  323 OS file reads, 165433 OS file writes, 150609 OS fsyncs

  0.00 reads/s, 0 avg bytes/read, 6.20 writes/s, 3.40 fsyncs/s

  -------------------------------------

  //mysql5.5文件I/O以下

  mysql> select version();

  +------------+

  | version() |

  +------------+

  | 5.5.21-log |

  +------------+

  1 row in set (0.00 sec)

  mysql> show variables like 'innodb_version';

  +----------------+-------+

  | Variable_name | Value |

  +----------------+-------+

  | innodb_version | 1.1.8 |

  +----------------+-------+

  FILE显示的关于mysql5.5 IO线程部份, 有四个读线程和四个写线程,一个插入线程和一个日记线程

  --------

  FILE I/O

  --------

  I/O thread 0 state: waiting for i/o request (insert buffer thread)

  I/O thread 1 state: waiting for i/o request (log thread)

  I/O thread 2 state: waiting for i/o request (read thread)

  I/O thread 3 state: waiting for i/o request (read thread)

  I/O thread 4 state: waiting for i/o request (read thread)

  I/O thread 5 state: waiting for i/o request (read thread)

  I/O thread 6 state: waiting for i/o request (write thread)

  I/O thread 7 state: waiting for i/o request (write thread)

  I/O thread 8 state: waiting for i/o request (write thread)

  I/O thread 9 state: waiting for i/o request (write thread)

  Pending normal aio reads: 0 [0, 0, 0, 0] , aio writes: 0 [0, 0, 0, 0] ,

  ibuf aio reads: 0, log i/o's: 0, sync i/o's: 0 www.110hack.com

  Pending flushes (fsync) log: 0; buffer pool: 0

  478 OS file reads, 3 OS file writes, 3 OS fsyncs

  0.00 reads/s, 0 avg bytes/read, 0.00 writes/s, 0.00 fsyncs/s

  -------------------------------------

  二,内存

  INNODB内存由三部份构成:缓冲池(buffer pool),重做日记缓冲池(redo log buffer)和额外的内存池(additional memory pool)

  //缓冲池(buffer pool),2GB

  root@test 18:13>show variables like 'innodb_buffer_pool_size';

  +-------------------------+------------+

  | Variable_name | Value |

  +-------------------------+------------+

  | innodb_buffer_pool_size | 2147483648 |

  +-------------------------+------------+

  1 row in set (0.00 sec)

  // 重做日记缓冲池(redo log buffer),16MB

  root@test 18:13>show variables like 'innodb_log_buffer_size';

  +------------------------+----------+

  | Variable_name | Value |

  +------------------------+----------+

  | innodb_log_buffer_size | 16777216 |

  +------------------------+----------+

  1 row in set (0.00 sec)

  //额外的内存池(additional memory pool),32MB,在innodb中默许值为1MB,innodb plugin默许值为8MB.用于存储数据字典和内部数据构造.

  root@test 18:14>show variables like 'innodb_additional_mem_pool_size';

  +---------------------------------+----------+

  | Variable_name | Value |

  +---------------------------------+----------+

  | innodb_additional_mem_pool_size | 33554432 |

  +---------------------------------+----------+

  1 row in set (0.00 sec) www.110hack.com

  有上可见,数据缓冲池站内存块绝大部份.

  关于数据缓冲池(innodb_buffer_pool)包含:数据页(data page),索引页(index page),undo页(undo page),插入缓冲(insert buffer),自适应哈希索引(adaptive hash index),锁信息(lock info),数据字典(data dictionary).

  3、关于innodb的master thread线程

  在mysql5.1中假如没有系统编译的innodb plugin插件引擎.系统默许的innodb引擎,主要的工作都有由一个master thread线程来完成.在innodb plugin引擎中,有线程池来完成,但是在mysql5.5社区版,是没有该功效,在mysql官方文档说线程池的利用在商业版可以用.

  每秒城市操作的内容:

  1,日记缓冲革新到磁盘,即便这个事件还没有提交,这种计划招致很大的事件提交(commit)时也会很快.

  2,归并插入缓冲,在判断I/O次数少于5次时,可以履行插入缓冲操作.

  3,INNODB存储引擎最多每次只会革新100个脏页到磁盘,每秒能否革新取决于脏页的比例,假如超越innodb_max_dirty_pages_pct设置的值,就会将100个脏页刷入文件.

  root@(none) 22:46>show variables like 'innodb_max_dirty_pages_pct';

  +----------------------------+-------+

  | Variable_name | Value |

  +----------------------------+-------+

  | innodb_max_dirty_pages_pct | 60 |

  +----------------------------+-------+

  innodb存储引擎的逻辑存储构造,默许情形下存放砸ibdata1空间中称之为表空间;当定义innodb_file_per_table时,存放在“表名”.idb中,包含数据,索引和插入缓冲;undo文件,系统事物信息和二次写缓冲任然保存在ibdata1中. www.110hack.com

  表空间由段(segment),区(extent),页(page)构成.

  segment由数据段,索引段,回滚段构成.

  extent由64个持续的页构成,每页大小为16KB,即大小为1MB.

  page(页)有数据页(b-tree page),undo页(undo page), 系统页(system page),事物数据页(transaction system page),插入缓冲位图页(insert buffer bitmap),插入缓冲闲暇列表页(insert buffer free list),未紧缩的二进制大对象页(uncompressed blob page),紧缩的二进制大对象页(compressed blob page)

  作者 alang85


  以上是“关于INNODB存储引擎体系构造简析[MySQL防范]”的内容,如果你对以上该文章内容感兴趣,你可以看看七道奇为您推荐以下文章:
  • 关于INNODB存储引擎体系构造简析
  • 本文地址: 与您的QQ/BBS好友分享!
    • 好的评价 如果您觉得此文章好,就请您
        0%(0)
    • 差的评价 如果您觉得此文章差,就请您
        0%(0)

    文章评论评论内容只代表网友观点,与本站立场无关!

       评论摘要(共 0 条,得分 0 分,平均 0 分) 查看完整评论
    Copyright © 2020-2022 www.xiamiku.com. All Rights Reserved .