12
返回列表 发新帖
楼主: myownstars

oracle如何优化大并发下的进程切换

[复制链接]
论坛徽章:
78
ITPUB15周年纪念
日期:2020-08-28 17:23:53双鱼座
日期:2016-03-19 19:38:31秀才
日期:2016-02-18 09:31:52秀才
日期:2016-01-25 15:02:04双子座
日期:2016-01-19 20:35:54秀才
日期:2016-01-13 12:14:26秀才
日期:2015-12-25 15:31:10秀才
日期:2015-12-18 09:28:57秀才
日期:2015-12-14 14:56:09秀才
日期:2015-12-14 14:51:16
11#
发表于 2015-9-2 13:08 | 只看该作者
另外mysql在大并发下并不见得好,不是connect pool就能解决所有问题,MYSQL这种没执行计划缓存的数据库实现,大并发必须靠sharding,提供更多的CPU,否则解析SQL耗死你

使用道具 举报

回复
论坛徽章:
122
现任管理团队成员
日期:2011-05-07 01:45:08
12#
发表于 2015-9-8 17:08 | 只看该作者
wolfop 发表于 2015-9-2 13:08
另外mysql在大并发下并不见得好,不是connect pool就能解决所有问题,MYSQL这种没执行计划缓存的数据库实现 ...

头像是 索尔维会议 的合照么? 太小了,看着很像~

使用道具 举报

回复
论坛徽章:
47
蒙奇·D·路飞
日期:2017-03-27 08:04:23马上有车
日期:2014-02-18 16:41:112014年新春福章
日期:2014-02-18 16:41:11一汽
日期:2013-09-01 20:46:27复活蛋
日期:2013-03-13 07:55:232013年新春福章
日期:2013-02-25 14:51:24ITPUB 11周年纪念徽章
日期:2012-10-09 18:03:322012新春纪念徽章
日期:2012-02-13 15:13:202012新春纪念徽章
日期:2012-02-13 15:13:202012新春纪念徽章
日期:2012-02-13 15:13:20
13#
发表于 2015-9-8 22:13 | 只看该作者
> MYSQL这种没执行计划缓存的数据库实现

According to "A Practical Look at the MySQL Query Cache"
ftp://ftp.fu-berlin.de/unix/data ... ql-query-cache.html

"Code caches are used to primarily lessen the impact of "hard parse" activity ... Examples include Oracle's shared pool/library cache, and SQL Server's and Sybase's SQL/Procedure caches."

So MySQL is not one of these databases. But the article goes on to say

"the query cache stores the SELECT queries issued by clients to the MySQL database server. In this respect, it acts a lot like traditional database SQL caches, in that identically issued queries will be located and re-issued by the database engine without hard parse activity"

So I'm confused. Isn't MySQL query cache equivalent to Oracle's library cache? (The article also says, not quoted here, the query cache also stores query result, which I think can be compared to Oracle's result cache. But that's not my interest for now.)

使用道具 举报

回复
论坛徽章:
78
ITPUB15周年纪念
日期:2020-08-28 17:23:53双鱼座
日期:2016-03-19 19:38:31秀才
日期:2016-02-18 09:31:52秀才
日期:2016-01-25 15:02:04双子座
日期:2016-01-19 20:35:54秀才
日期:2016-01-13 12:14:26秀才
日期:2015-12-25 15:31:10秀才
日期:2015-12-18 09:28:57秀才
日期:2015-12-14 14:56:09秀才
日期:2015-12-14 14:51:16
14#
发表于 2015-9-9 21:21 | 只看该作者
Yong Huang 发表于 2015-9-8 22:13
> MYSQL这种没执行计划缓存的数据库实现

According to "A Practical Look at the MySQL Query Cache"

Query cache is not a execution plan cache neither like the library cache. It is more like the oracle result cache which was introduced in 11G but with different implentation.

使用道具 举报

回复
论坛徽章:
47
蒙奇·D·路飞
日期:2017-03-27 08:04:23马上有车
日期:2014-02-18 16:41:112014年新春福章
日期:2014-02-18 16:41:11一汽
日期:2013-09-01 20:46:27复活蛋
日期:2013-03-13 07:55:232013年新春福章
日期:2013-02-25 14:51:24ITPUB 11周年纪念徽章
日期:2012-10-09 18:03:322012新春纪念徽章
日期:2012-02-13 15:13:202012新春纪念徽章
日期:2012-02-13 15:13:202012新春纪念徽章
日期:2012-02-13 15:13:20
15#
发表于 2015-9-10 00:03 | 只看该作者
> Query cache is not a execution plan cache neither like the library cache.

Thanks. How do we understand "the query cache stores the SELECT queries issued by clients to the MySQL database server"? Do you think it's incorrect? Or it's correct but the query cache only stores the query text strings without execution plans? Or something else?

使用道具 举报

回复
论坛徽章:
78
ITPUB15周年纪念
日期:2020-08-28 17:23:53双鱼座
日期:2016-03-19 19:38:31秀才
日期:2016-02-18 09:31:52秀才
日期:2016-01-25 15:02:04双子座
日期:2016-01-19 20:35:54秀才
日期:2016-01-13 12:14:26秀才
日期:2015-12-25 15:31:10秀才
日期:2015-12-18 09:28:57秀才
日期:2015-12-14 14:56:09秀才
日期:2015-12-14 14:51:16
16#
发表于 2015-9-10 20:46 | 只看该作者
Yong Huang 发表于 2015-9-10 00:03
> Query cache is not a execution plan cache neither like the library cache.

Thanks. How do we und ...

You understand should be right. No execution plan in Mysql.

使用道具 举报

回复
论坛徽章:
10
2011新春纪念徽章
日期:2011-02-18 11:43:342015年新春福章
日期:2015-03-06 11:58:18懒羊羊
日期:2015-03-04 14:52:11马上有钱
日期:2014-02-18 16:43:092014年新春福章
日期:2014-02-18 16:43:09优秀写手
日期:2013-12-18 09:29:11三菱
日期:2013-08-30 20:37:412013年新春福章
日期:2013-02-25 14:51:24ITPUB十周年纪念徽章
日期:2011-11-01 16:24:51暖羊羊
日期:2015-06-22 15:51:36
17#
 楼主| 发表于 2015-9-10 22:06 | 只看该作者
wolfop 发表于 2015-9-10 20:46
You understand should be right. No execution plan in Mysql.

确切的说,mysql不缓存重用执行计划,即每次sql都要硬解析;
个人观点:mysql只实现nest-loop join且没有直方图,硬解析选择执行计划的cost应该小很多(相比oracle),因此不需要缓存执行计划;
另外,我听过的说法,mysql大并发大场景下,全是因为上下文切换导致load飙高,很少有文章说因为sql解析导致

使用道具 举报

回复
论坛徽章:
47
蒙奇·D·路飞
日期:2017-03-27 08:04:23马上有车
日期:2014-02-18 16:41:112014年新春福章
日期:2014-02-18 16:41:11一汽
日期:2013-09-01 20:46:27复活蛋
日期:2013-03-13 07:55:232013年新春福章
日期:2013-02-25 14:51:24ITPUB 11周年纪念徽章
日期:2012-10-09 18:03:322012新春纪念徽章
日期:2012-02-13 15:13:202012新春纪念徽章
日期:2012-02-13 15:13:202012新春纪念徽章
日期:2012-02-13 15:13:20
18#
发表于 2015-9-11 03:09 | 只看该作者
> mysql大并发大场景下,全是因为上下文切换导致load飙高

Where do you read that? Is it high sys CPU? If it's high user CPU, that doesn't look like it.

I think MySQL already uses thread model. That is, one mysql process contains many threads, each *thread* corresponding to one client connection, unlike Oracle on UNIX/Linux where one *process* corresponds to one client connection by default. If MySQL uses thread model, why would there be high context switch?

使用道具 举报

回复
论坛徽章:
78
ITPUB15周年纪念
日期:2020-08-28 17:23:53双鱼座
日期:2016-03-19 19:38:31秀才
日期:2016-02-18 09:31:52秀才
日期:2016-01-25 15:02:04双子座
日期:2016-01-19 20:35:54秀才
日期:2016-01-13 12:14:26秀才
日期:2015-12-25 15:31:10秀才
日期:2015-12-18 09:28:57秀才
日期:2015-12-14 14:56:09秀才
日期:2015-12-14 14:51:16
19#
发表于 2015-9-11 21:16 | 只看该作者
本帖最后由 wolfop 于 2015-9-11 21:16 编辑
myownstars 发表于 2015-9-10 22:06
确切的说,mysql不缓存重用执行计划,即每次sql都要硬解析;
个人观点:mysql只实现nest-loop join且没有 ...
和是否nest loop join无关,join一般是DW用。DW是否有执行计划缓存反而不太重要。
mysql 大并发上下文切换?呵呵mysql用内核线程,context switch必然也有,不过ORACLE用process,恐怕context switch更高。估计还是mysql的实现的问题。
想想可能还是informix ids的架构理论上大并发比较好,因为是用用户线程实现,应该没什么内核的上下文切换。但是那个产品已经被IBM给废了。另外一个问题是你看不出MYSQL到底解析SQL用了多少资源,又没有AWR,而且解析应该是不用context switch

使用道具 举报

回复

您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

TOP技术积分榜 社区积分榜 徽章 团队 统计 知识索引树 积分竞拍 文本模式 帮助
  ITPUB首页 | ITPUB论坛 | 数据库技术 | 企业信息化 | 开发技术 | 微软技术 | 软件工程与项目管理 | IBM技术园地 | 行业纵向讨论 | IT招聘 | IT文档
  ChinaUnix | ChinaUnix博客 | ChinaUnix论坛
CopyRight 1999-2011 itpub.net All Right Reserved. 北京盛拓优讯信息技术有限公司版权所有 联系我们 未成年人举报专区 
京ICP备16024965号-8  北京市公安局海淀分局网监中心备案编号:11010802021510 广播电视节目制作经营许可证:编号(京)字第1149号
  
快速回复 返回顶部 返回列表