说明在亚马逊RDS / MySQL的这款内存的消费模式? [英] Explain this memory consumption pattern in Amazon RDS/Mysql?

查看:508
本文介绍了说明在亚马逊RDS / MySQL的这款内存的消费模式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

伙计们,

有人能解释一下MySQL运行在Amazon RDS此内存的消费模式?在该图中,予升级到db.m2.2xlarge,与可用内存34GB,03:30。你可以看到切换非常清楚。随着客户开始连接和击球该实例中,Freeable存储器急剧下降到5GB,在那里它现在徘徊。在数据库实例大小之间我的previous升级,我看到了同样的模式,直到freeable内存下降到不到1GB和那里徘徊无限期。

Can someone explain this memory consumption pattern on Amazon RDS running Mysql? In this graph, I upgraded to a db.m2.2xlarge, with 34GB of available memory, at 03:30. You can see the switchover very clearly. As clients start connecting and hitting that instance, the Freeable memory drops steeply to 5GB, where it is now hovering. On my previous upgrade between DB instance sizes, I saw the same pattern, until the freeable memory dropped to just under 1GB and hovered there indefinitely.

这是什么实例03:30和07:30之间在做什么?为什么不释放未使用的内存,因为它成为可用?我想我会想到这个图是一个波形,对应的使用和流量模式,VS和指数衰减形状,这表明它是一个超级懒惰和/或破碎的垃圾回收算法。

What is this instance doing between 03:30 and 07:30? Why isn't it freeing unused memory as it becomes available? I guess I would expect this graph to be a wave shape, corresponding to usage and traffic patterns, vs and exponential decay shape, which suggests that it's a super lazy and/or broken garbage collection algorithm.

还要注意的是大约2 /数据库操作的三分之二是写入和三分之一被读取,并有大约memcache的2GB的在DB的前面。

Also note that about 2/3rds of DB operations are writes and 1/3 are reads, and there is about 2GB of memcache in front of the DB.

推荐答案

的MySQL保持最近使用的表,查询和结果在存储器中的高速缓存,以便返回更快的结果。例如,如果您查询从客户端100万次,仅在第一次查询需要到磁盘,从公司其中id = 1选择*,接下来的999,999将直接来自于RAM缓存。没有理由为MySQL到期该缓存,直到它知道它需要更多的内存,因此它保持的东西保存,直到它需要释放内存为其他工作或经常使用的结果。

MySQL maintains a cache of recently used tables, queries and results in memory, in order to return faster results. For example, if you query "select * from company where id = 1" from a client 1 million times, only the first query needs to go to disk, the next 999,999 will come straight from the in RAM cache. There is no reason for MySQL to expire this cache until it knows it needs more memory, so it keeps things saved until it needs to free up RAM for other work or more frequently used results.

我不自称是一个专家 - 我明白数据库查询缓存优化是一个非常复杂而深刻的科学。在甲骨文,微软程序员和其他人度过了一年又一年工作了要管理的缓存空间的最佳方式,因此很难从外部predict。

I don't claim to be an expert - I understand DB query cache optimization to be a very complex and deep science. Programmers at Oracle, Microsoft and others have spent years and years working out the best way for the cache space to be managed, so it's hard to predict from the outside.

这篇关于说明在亚马逊RDS / MySQL的这款内存的消费模式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆