Your SlideShare is downloading. ×
MySQL aio
MySQL aio
MySQL aio
MySQL aio
MySQL aio
MySQL aio
MySQL aio
MySQL aio
MySQL aio
MySQL aio
MySQL aio
MySQL aio
MySQL aio
MySQL aio
MySQL aio
MySQL aio
MySQL aio
MySQL aio
MySQL aio
MySQL aio
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

MySQL aio

2,175

Published on

Published in: Education
0 Comments
6 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
2,175
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
69
Comments
0
Likes
6
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. MySQL AIO
    丹臣/赵林
    2011/8/16
  • 2. content
    aio参数,以及aio线程状态
    5个os_aio_array_struct结构体,以及初始化
    aio的消费者-IO线程的启动及运行流程
    aio的生产者
  • 3. aio参数
    一些控制参数:
    innodb_thread_concurrency=16
    innodb_read_io_threads=8
    innodb_write_io_threads=8
  • 4. 查看aio线程状态
    Show innodb statusG中FILE I/O部份
  • 5. 5个aio arrays的定义
  • 6. os_aio_array_struct
  • 7. aio初始化,以及创建I/O线程
    os_aio_init(io_limit,
    srv_n_read_io_threads,
    srv_n_write_io_threads,
    SRV_MAX_N_PENDING_SYNC_IOS);
    /* Create i/o-handler threads: */
    for (i = 0; i < srv_n_file_io_threads; i++) {
    n[i] = i;
    os_thread_create(io_handler_thread, n + i, thread_ids + i);
    }
  • 8. 这5个aio arrays数组初始化,请注意这个函数最上面的注解
  • 9. os_aio_array_create
    • slots指向一个os_aio_slot_t结构体数组,数组大小为n
    • 10. n_reserved是指这个array中正在使用的slot有多少个
    • 11. os_aio_slot_struct结构体中的reserved为true时,n_reserved会++1
  • I/O线程运行主函数
  • 12. fil_aio_wait函数
  • 13. os_aio_simulated_handle函数
  • 14. mutex为什么可以提前释放?
  • 15. os_aio_write_array
    一个segment包含很多个slots,这里每个只画了2个,是一个示例.每个segment会有对应的一个IO线程来处理.
    Segment 2
    Segment 3
    几个io线程消费slots,以及连接线程将aio请求放入slots中,每个线程都要去获得os_aio_write_array->mutex,所以这里存在争用,各个线程需要减少持有mutex的时间
    Segment 4
    Segment 5
  • 16. Mutex再次获得,修改slot状态
  • 17. 好处与前提
    最耗时的os i/o操作,io thread不会持有mutex,减少了mutex争用
    read/write aio array里存在多个segments,提高了并发
    os_aio_read_array
    os_aio_write_array
    前提:一个io线程只能操作对应的一个segment,其它io线程无法访问这个segment
  • 18. aio的生产者
    Fil_io
    /* Queue the aio request */
    ret = os_aio(type, mode | wake_later, node->name, node->handle, buf,offset_low, offset_high, len, node, message);
  • 19. aio的生产者
    fio_io调用os_aio函数
  • 20. os_aio_simulated_wake_handler_thread
  • 21. About me
    新浪微博:http://weibo.com/zhaolinjnu
    个人blog:http://zhaolinjnu.blog.sohu.com/
    Email: danchen@taobao.com

×