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. python几个特别函数map filter reduce lambda

    lambda函数也叫匿名函数,即,函数没有具体的名称.先来看一个最简单例子: def f(x): return x**2 print f(4) Python中使用lambda的话,写成这样 g = l ...

  2. HTML5给我们带来了什么

    websocket 根据维基定义 WebSocket 使得客户端和服务器之间的数据交换变得更加简单,允许服务端直接向客户端推送数据而不需要客户端进行请求,在 WebSocket API 中,浏览器和服 ...

  3. windows phone7开发环境配置错误

    遇到下面这样一个问题:在配置windows phoe7开发环境的时候出现如下错误,以及相应的解决方案,希望对大家有所帮助. 装完环境后出现下面错误: [caption id="attachm ...

  4. 【Cron Expressions】Quartz Scheduler 2.1.x 英文节选

    Cron Expressions Cron-Expressions are used to configure instances ofCronTrigger. Cron-Expressions ar ...

  5. Session 转台服务器的使用方法

    Session的缺陷:为了保持自身的稳定,IIS在访问量大的时候,可能会不自觉的重启,这时候Session就会丢失用户就会被迫下线 解决方案1:将Session放到一个专门的转台服务器上 方案2:将S ...

  6. ssh登录的时候,根本不给输入密码的机会,直接拒绝,是因为BatchMode的设置

    BatchMode no“BatchMode”如果设为“yes”,passphrase/password(交互式输入口令)的提示将被禁止.当不能交互式输入口令的时候,这个选项对脚本文件和批处理任务十分 ...

  7. 终于懂了:WM_PAINT中应该用BeginPaint与EndPaint这两个api,它们的功能正是使无效区域恢复(所以WM_PAINT里即使什么都不做,也必须写上BeginPaint与EndPaint)——Delphi里WM_PAINT消息的三个走向都做到了这一点 good

    程序本来是想实现鼠标单击改变背景颜色.可是,程序运行时,为什么没有任何消息触发,背景颜色就一直不断的改变了?WM_PAINT怎么被触发的 #include <windows.h> #inc ...

  8. Tomcat设置成NIO时,使用的线程池

    设置成NIO时, <Connector port="8088" protocol="org.apache.coyote.http11.Http11NioProtoc ...

  9. Managing your Actor Systems

    今天偶然得机会,找到一篇不错得文章,现在分享给大家. 原文:http://www.kotancode.com/2013/02/15/managing-your-actor-systems/ If yo ...

  10. 在Python中使用正则表达式同时匹配邮箱和电话并进行简单的分类

    在Python使用正则表达式需要使用re(regular exprssion)模块,使用正则表达式的难点就在于如何写好p=re.compile(r' 正则表达式')的内容. 下面是在Python中使用 ...