zoukankan      html  css  js  c++  java
  • 14.6.6 Configuring Thread Concurrency for InnoDB 配置线程并发

    14.6.6 Configuring Thread Concurrency for InnoDB  配置线程并发
    
    
    InnoDB 使用操作系统线程来处理请求(用户事务) 事务可能执行很多次在它们提交或者回滚前。
    
    在现在的操作系统,具有多核CPU 上下文切换是有效的, 很多的负载运行很好没有任何并发线程数量的限制
    
    
    在这种情况下 它是用助于最小化上下文切换在线程之间,
    
    InnoDB 使用一些技术来限制并发执行操作系统线程的数量(也就是说请求的数量任何一个时间的处理数量)
    
    
    当InnoDB 从用户会话接收一个新的请求,如果 并发线程的数量是在一个预定义的限制,
    
    新的请求会sleep一段时间在他再次尝试前。
    
    
    
    你可以设置并发线程的数量 通过设置r innodb_thread_concurrency参数
    
    
    mysql> show variables like '%innodb_thread_concurrency%';
    +---------------------------+-------+
    | Variable_name             | Value |
    +---------------------------+-------+
    | innodb_thread_concurrency | 0     |
    +---------------------------+-------+
    1 row in set (0.00 sec)
    
    
    一旦并发线程的数量达到这个值, 额外的线程sleep 会等待数微妙
    
    mysql> show variables like '%innodb_thread_sleep_delay%';
    +---------------------------+-------+
    | Variable_name             | Value |
    +---------------------------+-------+
    | innodb_thread_sleep_delay | 10000 |
    +---------------------------+-------+
    1 row in set (0.00 sec)
    此前,它需要实验来找出最有的值对于innodb_thread_sleep_delay, 最有的值
    
    可以改变取决于负载。
    
    在MySQL 5.6.3 and higher, 你可以设置配置选项 innodb_adaptive_max_sleep_delay为高的值
    
    
    InnoDB 自动调整innodb_thread_sleep_delay up或者down 取决于当前线程的活动
    
    
    默认值对于innodb_thread_concurrency 和说明默认限制在并发线程数量上已经被改变了再各个版本
    
    
    innodb_thread_concurrency 默认值是0,这样没有没有限制
    
    
    InnoDB 导致线程sleep 只有当并发线程的数量被限制。
    
    当没有线程限制时,所有的竞争都会被调度。
    
    也就是说,如果 innodb_thread_concurrency设置为0, innodb_thread_sleep_delay 会被忽略
    
    
    当有一个线程数限制时(当innodb_thread_concurrency is > 0),
    
    InnoDB 减少上下文切换通过运行多个请求在一个SQL语句执行到InnoDB 没有观察限制通过innodb_thread_concurrency. 
    

  • 相关阅读:
    memcached与redis的一些区别小结
    ubuntu下定时任务
    hdu4135 容斥定理
    hdu1251 统计难题 字典树
    hdu1710 Binary Tree Traversals(二叉树的遍历)
    Codeforces Round #364 (Div. 2) B. Cells Not Under Attack
    KMP算法 hdu4686 Oulipo
    判断字符串是否在字典里
    floyd算法 poj2253
    最短路径dijkstra算法
  • 原文地址:https://www.cnblogs.com/zhaoyangjian724/p/6199020.html
Copyright © 2011-2022 走看看