缓存命中率对性能的影响
我目前正在阅读布伦丹·格雷格(Brendan Gregg)的第二版系统性能,并在第2章中对缓存的部分提出了一个疑问。本节定义了高速公路命中率,因为
hit ratio = hits / (hits + misses)
它继续说,加速命中率与“性能”之间的关系。 (对于系统性能的某些假设度量)是非线性的。具体来说,
98%至99%之间的性能差异远大于10%至11%。这是一个非线性配置文件,因为高速击击和错过之间的速度差异 - 播放的两个存储层。差异越大,坡度越陡。
我不太了解这种关系中的非线性来自哪里。为了向自己解释这一点,我编造了以下示例。考虑以下内容,我们通过某些函数f
对性能进行建模,其中f
的较低值表示性能更好。
f(hit) = 10
f(miss) = 100
IE的错过比命中率高10倍。假设命中率为0,则该系统的“预期”性能为(0*10) +(1*100)= 100
。 .01(1%命中)的HIT率产生(。01*10)+(。99*100)= 99.1
。最后,命中率为.02(2%命中)产生(。02*10) +(.98*100)= 98.2
。 Afaict,这是一种线性关系。我想念什么?
谢谢
I'm currently reading the second edition of Systems Performance by Brendan Gregg and had a question on the section about caching in Chapter 2. This section defines cache hit ratio as
hit ratio = hits / (hits + misses)
It goes on to say that the relationship between cache hit ratio and "performance" (for some hypothetical measure of system performance) is nonlinear. Specifically,
The performance difference between 98% and 99% is much greater than that between 10% and 11%. This is a nonlinear profile because of the difference in speed between cache hits and misses - the two storage tiers at play. The greater the difference, the steeper the slope becomes.
I don't quite understand where the nonlinearity in this relationship originates from. In order to explain this to myself, I concocted the following example. Consider the following, we model performance by some function f
, where a lower value of f
denotes better performance.
f(hit) = 10
f(miss) = 100
i.e. misses are 10x more expensive than hits. Assuming a hit ratio of 0, the "expected" performance of this system will be (0*10) + (1*100) = 100
. A hit ratio of .01 (1% hits) yields (.01*10)+(.99*100) = 99.1
. Finally a hit ratio of .02 (2% hits) yields (.02*10) + (.98*100) = 98.2
. AFAICT, this is a linear relationship. What am I missing?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
阅读同一本书后,我也有同样的问题,现在我回答了我的问题,所以我会回答。
性能是非线性的,因为执行时间和性能是不同的。
正如您所写的那样,具有
f
的方程式(例如(0*10) +(1*100)= 100
)在HIT率中是线性的。但是,它实际上并不代表性能,而是平均执行时间。
性能是相对的,在比较两种性能时,我们使用执行时间的倒数的比率。
这种逆是看似线性但实际上是非线性行为的来源。
我是一个非本地人的英语,很抱歉,如果很难阅读。
希望我的答案对您有帮助。
I had the same question after reading the same book, and now that I have answered my question, so I will answer it.
Performance is nonlinear with hit rate because execution time and performance are different things.
As you wrote, equations with
f
(eg.(0*10) + (1*100) = 100
) is linear in the hit ratio.However, it does not actually represent performance, but average execution time.
Performance is relative, and when comparing two performances, we use the ratio of the inverse of the execution time.
This inverse is the source of the seemingly linear but actually nonlinear behavior.
I'm a non-native English speaker, so sorry if it's hard to read.
I hope my answer helps you.