ASP.net 缓存过度使用?
在一个 Web 项目中,我对表的索引列执行 SELECT SQL 查询 10-15 行。
我想问您是否可以将此查询缓存在服务器内存中,因为针对索引表的 SELECT 很轻且快速,而且一点也不复杂。我将许多东西缓存到内存(4GB)左右,并且我不想缓存这样的简单查询。
我的问题是,如果存在任何反对获取缓存数据的情况,此查询会对性能产生什么影响。
In a web project I perform a SELECT SQL query against an Indexed column of a table with
10-15 rows.
I want to ask you if it's good to cache this query in server memory as this SELECT against indexed tables is light and fast and its not complex at all. I cache to memory many things around (4GB) and I don't want to cache simple queries like this.
My question is what is the performance impact of this query if there is any against fetching cached data.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在我看来,这些数据在缓存中实际占用的空间量非常小,几乎可以忽略不计。如果总缓存空间为 4GB,那么该查询可能会占用多少空间?让我们做一个非常保守的假设,假设它的空间为 1MB。 1MB 是 4GB 的 0.025%。
此外,如果需要,您可以在将数据输入 .NET 缓存时使用 CacheItemPriority 为其分配低优先级。 ASP.NET CacheItemPriority< /a>
It seems to me that the amount of space this data would actually take up in the cache is so small as to be almost insignificant. If the total cache space is 4GB, how much of that can this query possibly take up? Let's make a massively conservative assumption and say its 1MB of space. 1MB is 0.025% of 4GB.
Also, You can use the CacheItemPriority to assign a low priority to this data when entering it into the .NET cache if you want to. ASP.NET CacheItemPriority