14.4.6 Configuring Thread Concurrency for InnoDB  配置Thread 并发

InnoDB 使用操作系统threads 来处理用户的事务请求。(事务可以执行很多请求到InnoDB 在它们提交或者回

滚前)

在现代的操作系统和多核服务器,
上下文切换是有效的,很多的负载运行很多在没有任何并发数限制。 可扩展性改进在MySQL 5.5和以上版本按降低了并发数量的限制 它是有助于减少上下文切换在threads之间,InnoDB 可以使用一些技术来限制并发执行操作系统threads的数 量
(因此,在任何一个时间点处理的请求数). 当InnoDB 接收一个新的请求从一个用户会话,如果threads的并发数量在一个预先定义的限制, 新的请求sleep 短暂的时间在它再次尝试之前,请求不能被重新安排在sleep 被放入到 first-in/first-out 队列
你可以限制并发线程数 通过设置 innodb_thread_concurrency. mysql> show variables like '%innodb_thread_concurrency%';
+---------------------------+-------+
| Variable_name | Value |
+---------------------------+-------+
| innodb_thread_concurrency | 0 |
+---------------------------+-------+
1 row in set (0.00 sec) 一旦 执行的threads 达到这个限制,额外的threads 会等待数微妙, 此前, 它需要经验来找到优化的值对于innodb_thread_sleep_delay, 优化的值可以改变依赖复杂, 在MySQL 5.6.3 和更高的版本,你可以设置配置选项 innodb_adaptive_max_sleep_delay 到允许的对于innodb_thread_sleep_delay, InnoDB 自动调整innodb_thread_sleep_delay 高或者低 依赖于当前的thread-scheduling activity 这个动态调整有助于thread scheduling 机制来工作平顺的 在系统是负载较轻的和接近于满负荷 InnoDB 使线程sleep只有当 并发的线程数受限制, 当对于线程数没有限制的时候, 所有的线程都会被调度。也就是说, 如果 innodb_thread_concurrency是0, innodb_thread_sleep_delay 会被忽略。 当这里有限制限制时( 当innodb_thread_concurrency 值大于0), InnoDB 降低上下文负载通过允许多个请求 在单个SQL语句执行期间来进入InnoDB 没有关注 innodb_thread_concurrency的设置。 因为一个SQL语句(比如一个关联)
可能 包含多个行记录在InnoDB,InnoDB 分配一个指定数量的tickets 允许一个线程被调度多次 以最小的开销 当一个SQL 语句启动, 一个thread 没有tickets, 它必须观察innodb_thread_concurrency。 一旦线程有权进入InnoDB, 它会被分配一个 rickets的number 可以用于随后进入InnoDB 来执行记录操作。 如果tickets 用完, thread 被驱逐,innodb_thread_concurrency 再次观察,可以放置thread 到 等待thread 的first-in/first-out queue。 当thread 是再次允许进入InnoDB, tickets 再次被分配。 分配的tickets 的数量是通过全局变量 innodb_concurrency_tickets指定,默认是5000 mysql> show variables like '%innodb_concurrency_tickets%';
+----------------------------+-------+
| Variable_name | Value |
+----------------------------+-------+
| innodb_concurrency_tickets | 5000 |
+----------------------------+-------+
1 row in set (0.00 sec) 一个thread 等待一个lock 是给一个ticket 一旦locks 变的可用 那些变量的争取的值依赖你的环境和负载, 尝试一些不同的值来决定最合适的值对你的应用。 在限制并发执行threads的数量, 重新查询配置选项 可能改善InnoDB的性能

14.4.6 Configuring Thread Concurrency for InnoDB 配置Thread 并发的更多相关文章

  1. 14.6.6 Configuring Thread Concurrency for InnoDB 配置线程并发

    14.6.6 Configuring Thread Concurrency for InnoDB 配置线程并发 InnoDB 使用操作系统线程来处理请求(用户事务) 事务可能执行很多次在它们提交或者回 ...

  2. 14.6.11 Configuring Optimizer Statistics for InnoDB 配置优化统计信息用于InnoDB

    14.6.11 Configuring Optimizer Statistics for InnoDB 配置优化统计信息用于InnoDB 14.6.11.1 Configuring Persisten ...

  3. 15.6.6 Configuring Thread Concurrency for InnoDB

    innodb_thread_concurrency 设置inndb线程个数,如果超过则休眠一段时间,时间根据 innodb_thread_sleep_delay 单位为微妙,然后放进队列. innod ...

  4. MySQL InnoDB配置并发线程( innodb_thread_concurrency)

    http://www.ywnds.com/?p=9821 一.thread_concurrency 首先,最重要的一点,这个参数已经在最新版本的MySQL中被移除了,官方最新5.7版本的doc上面对t ...

  5. 14.6.8 Configuring the InnoDB Master Thread IO Rate 配置InnoDB 主线程IO 速率:

    14.6.8 Configuring the InnoDB Master Thread IO Rate 配置InnoDB 主线程IO 速率: 主线程 在InnoDB 是一个线程 执行各种任务在后台. ...

  6. 14.4.8 Configuring the InnoDB Master Thread IO Rate 配置InnoDB Master Thread I/O Rate

    14.4.8 Configuring the InnoDB Master Thread IO Rate 配置InnoDB Master Thread I/O Rate 主的master thread ...

  7. 14.6.7 Configuring the Number of Background InnoDB IO Threads 配置InnoDB IO Threads的数量

    14.6.7 Configuring the Number of Background InnoDB IO Threads 配置InnoDB IO Threads的数量 InnoDB 使用后台线程来服 ...

  8. 14.6.2 Configuring InnoDB for Read-Only Operation

    14.6.2 Configuring InnoDB for Read-Only Operation 配置InnoDB只读操作 你可以查询InnoDB 表MySQL 数据目录是一个只读介质,通过启用 - ...

  9. 14.4.7 Configuring the Number of Background InnoDB IO Threads 配置 后台InnoDB IO Threads的数量

    14.4.7 Configuring the Number of Background InnoDB IO Threads 配置 后台InnoDB IO Threads的数量 InnoDB 使用bac ...

随机推荐

  1. 分享非常有用的Java程序 (关键代码) (一)

    原文:分享非常有用的Java程序 (关键代码) (一)   分享一些非常有用的Java程序 (关键代码) ,希望对你有所帮助. 1.  得到当前方法的名字 String methodName = Th ...

  2. docker学习笔记3:镜像操作(查找和下载)

    一.查看本地镜像 只有下载后,镜像才会保存在本地(docker环境所在的主机),通过如下命令可以查看本地已经存在的镜像. 命令:dokcer images 上面命令列出本地所有已经存在的镜像,显示的信 ...

  3. Solr搜索结果说明

    在admin页面,输入相关内容后,会返回xml格式的内容.说明如下: [html] view plaincopy <?xml version="1.0" encoding=& ...

  4. 百度2015校园招聘自然语言处理project师面试

    面了一个多小时,大致回想下 1. 介绍一下简历上的项目 这个讲了好长时间,由于我做的是生物信息,面试官听得不太明确. 2. 一个城市每对夫妇都要生到一个男孩才停止生育,问终于该城市的男女比例 1:1, ...

  5. 将DataTable 存到一个集合当中

    将DataTable 存到一个集合中 此做法来自:http://www.codeproject.com/Articles/692832/Simple-way-of-using-SQL-DataTabl ...

  6. 获取DOM元素位置和尺寸大小

    JavaScript获取DOM元素位置和尺寸大小 在一些复杂的页面中经常会用JavaScript处理一些DOM元素的动态效果,这种时候我们经常会用到一些元素位置和尺寸的计算,浏览器兼容性问题也是不可忽 ...

  7. JS firebug小技巧

    实际上前端的发展与进步也离不开浏览器的支持,而对于开发者来讲,浏览器最好的支持,就是对于debug的良好支持,甚至在某些兴许接手的项目中,前端的debug甚至能够解决好多问题--不说了,都是泪啊!还是 ...

  8. HDOJ 1800 Flying to the Mars 盲目搜索......................so easy...........

    check the original problem here:http://acm.hdu.edu.cn/showproblem.php?pid=1800 the AC code: #include ...

  9. google浙大招聘笔试题 师兄只能帮你到这儿了

    google浙大招聘笔试题 一.单选1.80x86中,十进制数-3用16位二进制数表示为?00100002.假定符号-.*.$分别代表减法.乘法和指数运算,且 1)三个运算符优先级顺序是:-最高,*其 ...

  10. EasyUI - ValidateBox 验证组件

    基本效果: 效果: Html代码: <input id="email" /> JS代码: 默认的有四种验证方式: email:验证邮箱 url:验证url length ...