简体   繁体   English

具有许多项目的System.Runtime.Caching.Cache性能

[英]System.Runtime.Caching.Cache performance with many items

In my website as there are many joins in stored procedure that returns results I want to cache the results for each page and remove and re-add only when there is a change. 在我的网站中,由于存储过程中有许多联接返回结果,因此我想缓存每个页面的结果,仅在发生更改时才删除并重新添加。

Now the question is that in this case there will be about 200000 cached items that for each page I will need to find from cache. 现在的问题是,在这种情况下,我需要从缓存中找到的每个页面大约有200000个缓存项。 I want to know how would be the performance of the cache with many Items? 我想知道许多项目的缓存性能如何?

I know that, I should compare this with the speed of running stored procedure but here what I want to know is the cache speed not its relativity and comparison with getting result from database. 我知道,我应该将其与运行存储过程的速度进行比较,但是在这里我想知道的是缓存速度,而不是它的相对性以及与从数据库获取结果的比较。 In the other words I want to know how much Increasing the number of cached items would effect the performace? 换句话说, 我想知道多少增加缓存项的数量会影响性能?

Cache lookups are O(1). 缓存查找为O(1)。 So as long as you an actually fit all necessary data in memory the speed of finding item should not change. 因此,只要您实际将所有必需的数据放入内存中,查找项目的速度就不会改变。

Make sure if you have plenty of RAM, using x64 machine/build and indeed run your own performance tests to confirm that your caching works for your cases. 确保使用x64机器/内部版本,如果您有足够的RAM,并确实运行自己的性能测试,以确保您的缓存适用于您的情况。

If you want to double-check - source is available on http://referencesource.microsoft.com/#System.Runtime.Caching/System/Caching/MemoryCache.cs 如果要仔细检查,请访问http://referencesource.microsoft.com/#System.Runtime.Caching/System/Caching/MemoryCache.cs上的源。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何检查System.Runtime.Caching.ObjectCache中的缓存策略? - How to inspect cache policies inside System.Runtime.Caching.ObjectCache? 更改System.Runtime.Caching文件缓存中的文件位置 - Change file location in System.Runtime.Caching file cache 使用 system.runtime.caching 缓存列表数据 - using system.runtime.caching to cache list data System.Runtime.Caching.MemoryCache列表缓存实例 - System.Runtime.Caching.MemoryCache list cache instances 添加到System.Web.Caching.Cache的项目的默认行为是什么? - What is the default behavior for items added to System.Web.Caching.Cache? 在被驱逐时,System.Runtime.Caching.MemoryCache会处理IDisposable项目吗? - Will System.Runtime.Caching.MemoryCache dispose IDisposable items when evicted? System.Runtime.Caching内存缓存c#中每个对象占用的列表大小 - List size each object take up in System.Runtime.Caching memory cache c# System.Runtime.Caching GetCount()不同,具体取决于我从何处调用缓存? - System.Runtime.Caching GetCount() is different depending on where I call the cache from? 将多个项添加到缓存时,Runtime.Caching.MemoryCache会抛出OutOfMemoryException - Runtime.Caching.MemoryCache throws OutOfMemoryException when add many item to cache System.Runtime.Caching.MemoryCache 与 HttpRuntime.Cache - 有什么区别吗? - System.Runtime.Caching.MemoryCache vs HttpRuntime.Cache - are there any differences?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM