如何确定 ASP.NET 缓存的大小(以字节为单位)?
我正在积极开发一个使用服务器端缓存的 ASP.NET Web 应用程序,并且我试图了解如何在某些规模测试期间监视此缓存的大小。缓存存储各种大小的 XML 文档,其中一些大小为数兆字节。
在 System.Web.Caching.Cache System.Web.Caching 命名空间 I 的对象查看各种属性,包括计数 ,它获取“缓存中存储的项目数”和 EffectivePrivateBytesLimit,获取“可用于缓存的字节数”。没有任何信息告诉我缓存的大小(以字节为单位)。
在“. NET Framework 应用程序”指南中,有一个“管理缓存对象”部分,其中有一个表(表 2.2:用于监视缓存的应用程序性能计数器)列出了一组应用程序性能计数器,但我没有看到任何给我的信息缓存的当前大小。
找到此缓存大小的好方法是什么?我是否必须对缓存设置字节限制并查看其中一项周转率?我是否以错误的方式思考这个问题?是如何确定 ASP.Net 缓存总大小的答案 真的是最好的方法吗?
I'm in active development of an ASP.NET web application that is using server side caching and I'm trying to understand how I can monitor the size this cache during some scale testing. The cache stores XML documents of various sizes, some of which are multi-megabyte.
On the System.Web.Caching.Cache object of System.Web.Caching namespace I see various properties, including Count, which gets "the number of items stored in the cache" and EffectivePrivateBytesLimit, which gets "the number of bytes available for the cache." Nothing tells me the size in bytes of the cache.
In the Understanding Caching Technologies section of the "Caching Architecture Guide for .NET Framework Applications" guide, there is a "Managing the Cache Object" section with a table (Table 2.2: Application performance counters for monitoring a cache) listing a set of application performance counters, but I don't see any that give me the current size of the cache.
What is a good way to find the size this cache? Do I have to set a byte limit on the cache and look at one of the turnover rates? Am I thinking of this problem in the wrong way? Is the answer to How to determine total size of ASP.Net cache really the best way to go?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我打算对答案进行不太详细的说明 您在问题中提到,直到我读到为止。我建议你参考一下这个,对我来说似乎很合适。没有比查看服务器上的物理尺寸更好的方法了,其他任何东西都可能不准确。
您可能想要设置一些监控,Powershell 脚本可能可以方便地记录这些监控并在报告中发送给您自己。这样你就可以在一夜之间运行各种测试并进行总结。
顺便说一句,它们听起来像是要放入内存缓存中的非常大的文档。您是否考虑过 基于磁盘缓存这些较大的项目,并为较小的项目留下内存,这对它来说更理想。如果您的磁盘速度相当快,这应该具有相当的性能。
I was about to give a less detailed account of the answer you refer to in your question until I read that. I would refer you to this, seems spot on to me. No better way than seeing the physical size on the server, anything else might not be accurate.
You might want to set up some monitoring, for which a Powershell script might be handy to record and send on to yourself in a report. This way you could run various tests overnight say and summarise it.
On a side note, they sound like very large documents to be putting in a memory cache. Have you considered a disk based cache for these larger items and leaving the memory for smaller items which is more ideal for it. If your disks are reasonably fast this should be fairly performant.