热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

MySQLThreadPool:ProblemDefinition

MySQLThreadPool:ProblemDefinition
A new thread pool plugin is now a part of the MySQL Enterprise Edition.

In this blog we will cover the problem that the thread pool is solving

and some high-level description of how it solves this problem.

In the traditional MySQL server model there is a one-to-one mapping between

thread and connection. Even the MySQL server has lots of code where thread

or some abbreviation of thread is actually representing a connection.

Obviously this mapping has served MySQL very well over the years, but there

are some cases where this model don't work so well.

One such case is where there are much more connections executing queries

simultaneously compared to the number of CPUs available in the server. The

MySQL Server also have scalability bottlenecks where performance suffers

when too many connections execute in parallel.

So effectively there are two reasons that can make performance suffer in

the original MySQL Server model.

The first is that many connections executing in parallel means that the

amount of data that the CPUs work on increases. This will decrease the

CPU cache hit rates. Lowering the CPU cache hit rate can have a significant

negative impact on server performance. Actually in some cases the amount

of memory allocated by the connections executing in parallel could at times

even supersede the memory available in the server. In this case we enter a

state called swapping which is very detrimental to performance.

The second problem is that the number of parallel queries and transactions

can have a negative impact on the throughput through the "critical sections"

of the MySQL Server (critical section is where mutexes are applied to

ensure only one CPU changes a certain data structure at a time, when such

a critical section becomes a scalability problem we call it a hot spot).

Statements that writes are more affected since they use more critical

sections.

Neither of those problems can be solved in the operating system scheduler.

However there are some operating systems that have attempted solving this

problem for generic applications on a higher level in the operating system.

Both of those problems have the impact that performance suffers more and

more as the number of statements executed in parallel increases.

In addition there are hot spots where the mutex is held for a longer time

when many concurrent statements and/or transactions are executed in

parallel. One such example is the transaction list in InnoDB where each

transaction is listed in a linked list. Thus when the number of concurrent

transactions increases the time to scan the list increases and the time

holding the lock increases and thus the hot spot becomes even hotter

as the concurrency increases.

Current solutions to these issues exist in InnoDB through use of the

configuration parameter --innodb-thread-concurrency. When this parameter

is set to a nonzero value, this indicates how many threads are

able to run through InnoDB code concurrently. This solution have its

use cases where it works well. It does however have the drawback that

the solution itself contains a hot spot that limits the MySQL server

scalability. It does also not contain any solution to limiting the

number of concurrent transactions.

In a previous alpha version of the MySQL Server (MySQL 6.0) a thread

pool was developed. This thread pool solved the problem with limiting

the number of concurrent threads executing. It did nothing to solve

the problem with limiting the number of concurrent transactions.

It was also a scalability bottleneck in itself. Finally it didn't

solve all issues regarding long queries and blocked queries.

This made it possible for the MySQL Server to become completely

blocked.

When developing the thread pool extension now available in the MySQL

Enterprise Edition we decided to start from a clean plate with the

following requirements:

1) Limit the number of concurrently executing statements to ensure

that each statement execution has sufficient CPU and memory resources

to fulfill its task.

2) Split threads and connection into thread groups that are

independently managed. This is to ensure that the thread pool

plugin itself doesn't become a scalability bottleneck. The

aim is that each thread group has one or zero active threads

at any point in time.

3) Limit the number of concurrently executing transactions

through prioritizing queued connections dependent on if

they have started a transaction or not.

4) Avoid deadlocks when a statement execution becomes long or

when the statement is blocked for some reason for an extended

time.

If you are interested in knowing more details of how the new

thread pool solves these requirements there will be a

webinar on Thursday 20 Oct 2011 at 9.00 PDT. Check here

for details on how to access it.

If you want to try out the thread pool go here.

参考:

http://mikaelronstrom.blogspot.ae/2011/10/mysql-thread-pool-problem-definition.html

推荐阅读
  • ☞░前往老猿Python博客https:blog.csdn.netLaoYuanPython░一、引言在写该文之前,老猿就图像的一些运算已经单独边学边发了࿰ ... [详细]
  • 翻译 | 编写SVG的口袋指南(上)
    作者:DDU(沪江前端开发工程师)本文是原文翻译,转载请注明作者及出处。简介ScalableVectorGraphics(SVG)是在XML中描述二维图形的语言。这些图形由路径,图 ... [详细]
  • 本文介绍了在开发Android新闻App时,搭建本地服务器的步骤。通过使用XAMPP软件,可以一键式搭建起开发环境,包括Apache、MySQL、PHP、PERL。在本地服务器上新建数据库和表,并设置相应的属性。最后,给出了创建new表的SQL语句。这个教程适合初学者参考。 ... [详细]
  • 本文介绍了数据库的存储结构及其重要性,强调了关系数据库范例中将逻辑存储与物理存储分开的必要性。通过逻辑结构和物理结构的分离,可以实现对物理存储的重新组织和数据库的迁移,而应用程序不会察觉到任何更改。文章还展示了Oracle数据库的逻辑结构和物理结构,并介绍了表空间的概念和作用。 ... [详细]
  • Java实战之电影在线观看系统的实现
    本文介绍了Java实战之电影在线观看系统的实现过程。首先对项目进行了简述,然后展示了系统的效果图。接着介绍了系统的核心代码,包括后台用户管理控制器、电影管理控制器和前台电影控制器。最后对项目的环境配置和使用的技术进行了说明,包括JSP、Spring、SpringMVC、MyBatis、html、css、JavaScript、JQuery、Ajax、layui和maven等。 ... [详细]
  • CSS3选择器的使用方法详解,提高Web开发效率和精准度
    本文详细介绍了CSS3新增的选择器方法,包括属性选择器的使用。通过CSS3选择器,可以提高Web开发的效率和精准度,使得查找元素更加方便和快捷。同时,本文还对属性选择器的各种用法进行了详细解释,并给出了相应的代码示例。通过学习本文,读者可以更好地掌握CSS3选择器的使用方法,提升自己的Web开发能力。 ... [详细]
  • Oracle Database 10g许可授予信息及高级功能详解
    本文介绍了Oracle Database 10g许可授予信息及其中的高级功能,包括数据库优化数据包、SQL访问指导、SQL优化指导、SQL优化集和重组对象。同时提供了详细说明,指导用户在Oracle Database 10g中如何使用这些功能。 ... [详细]
  • 本文主要解析了Open judge C16H问题中涉及到的Magical Balls的快速幂和逆元算法,并给出了问题的解析和解决方法。详细介绍了问题的背景和规则,并给出了相应的算法解析和实现步骤。通过本文的解析,读者可以更好地理解和解决Open judge C16H问题中的Magical Balls部分。 ... [详细]
  • 本文介绍了在Win10上安装WinPythonHadoop的详细步骤,包括安装Python环境、安装JDK8、安装pyspark、安装Hadoop和Spark、设置环境变量、下载winutils.exe等。同时提醒注意Hadoop版本与pyspark版本的一致性,并建议重启电脑以确保安装成功。 ... [详细]
  • 本文介绍了在SpringBoot中集成thymeleaf前端模版的配置步骤,包括在application.properties配置文件中添加thymeleaf的配置信息,引入thymeleaf的jar包,以及创建PageController并添加index方法。 ... [详细]
  • 知识图谱——机器大脑中的知识库
    本文介绍了知识图谱在机器大脑中的应用,以及搜索引擎在知识图谱方面的发展。以谷歌知识图谱为例,说明了知识图谱的智能化特点。通过搜索引擎用户可以获取更加智能化的答案,如搜索关键词"Marie Curie",会得到居里夫人的详细信息以及与之相关的历史人物。知识图谱的出现引起了搜索引擎行业的变革,不仅美国的微软必应,中国的百度、搜狗等搜索引擎公司也纷纷推出了自己的知识图谱。 ... [详细]
  • 本文介绍了在Mac上搭建php环境后无法使用localhost连接mysql的问题,并通过将localhost替换为127.0.0.1或本机IP解决了该问题。文章解释了localhost和127.0.0.1的区别,指出了使用socket方式连接导致连接失败的原因。此外,还提供了相关链接供读者深入了解。 ... [详细]
  • yum安装_Redis —yum安装全过程
    篇首语:本文由编程笔记#小编为大家整理,主要介绍了Redis—yum安装全过程相关的知识,希望对你有一定的参考价值。访问https://redi ... [详细]
  • 解决VS写C#项目导入MySQL数据源报错“You have a usable connection already”问题的正确方法
    本文介绍了在VS写C#项目导入MySQL数据源时出现报错“You have a usable connection already”的问题,并给出了正确的解决方法。详细描述了问题的出现情况和报错信息,并提供了解决该问题的步骤和注意事项。 ... [详细]
  • 本文详细介绍了MySQL表分区的创建、增加和删除方法,包括查看分区数据量和全库数据量的方法。欢迎大家阅读并给予点评。 ... [详细]
author-avatar
aaa
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有