何时以及如何去在asp.net mvc的表演缓存? [英] When and how to go about performing caching in asp.net mvc?

查看:108
本文介绍了何时以及如何去在asp.net mvc的表演缓存?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

更新:我也发现的 NCACHE 这似乎是有用的,也来到<一个href=\"http://meta.stackexchange.com/questions/69164/does-stackoverflow-use-caching-and-if-so-how\">know该计算器使用 Redis的缓存。我也碰到过 memcached的并似乎更好的替代品之一。

UPDATE : I also found ncache which seems useful and also came to know that stackoverflow uses redis for caching. I also have come across memcached and seems one of the better alternatives.

我发现但我需要知道什么是我可以缓存一些我的LINQ查询,并有效地使用它们的方式。我发现<一个href=\"http://www.c-sharpcorner.com/UploadFile/dhananjay$c$cr/outputcachinginmvcapplication02222009222109PM/outputcachinginmvcapplication.aspx\"相对=nofollow>输出缓存asp.net mvc的有其他的方法可以做到高速缓存?

I have found this but I needed to know what are the ways in which I can cache some of my LINQ queries and use them efficiently. I found Output cache in asp.net mvc are there other ways to do caching?

我是怎样的一个新手之前,所以我会AP preciate如果任何人都可以点我在这里正确的方向从来没有做过缓存?主要是我想回答时,将缓存必要的,如何去在asp.net mvc的做缓存?到

I am kind of a newbie and never done caching before so I would appreciate if anyone can point me in the right direction here? Mainly I want answer to when would be caching necessary and how to go about doing caching in asp.net mvc ?

推荐答案

在我的经验,应用级缓存很少是正确的方法来解决性能问题,它几乎总是会导致更多的问题比它解决的问题。

In my experience application level caching is rarely the correct approach to fixing performance issues and it nearly always causes more problems than it solves.

在你着手任何缓存您应该首先:

Before you embark on any caching you should first:

(一)配置您的应用程序,这让看是否能解决他们太宽直接(如查询模式(取不显示的列)或过深(如读取,而显示更多的行查询),过于频繁(延迟加载可能会造成更多的往返比你需要的),太贵了(可怜表的设计可能意味着更多的加入比你需要的),或表本身可能未正确索引;

(i) profile your application and the queries it makes to see if you can address them directly (e.g. query patterns that are too wide (fetching columns that aren't displayed) or too deep (e.g. fetching more rows than you display), too frequent (lazy loading might be causing more round trips than you need), too expensive (poor table design might mean more joins than you need), or the tables themselves might not be indexed correctly;

(ii)就在你的网站的整体外观和用户体验看你怎么能提高感知性能(例如设置正确的浏览器层面上的静态内容缓存缓存头)。使用Ajax可能和喜欢的jqGrid分页网格视图可能会消除许多数据库在用户正在翻阅记录,因为网页内容的其余部分是不会改变的访问。

(ii) take a holistic look at your web site and the user experience to see how you can improve the perceived performance (e.g. set proper browser-level cache cache headers on static content). Using AJAX might and a paged grid view like jQGrid might eliminate many database accesses while a user is paging through records because the rest of the page content is not changing.

您已经用尽固定真正的问题后,你便可以再准备考虑缓存。

After you've exhausted fixing the real problem you may then then be ready to consider caching.

但在此之前,做一个简单的计算:多少钱升级的服务器成本相较于开发和测试时间,你将花费实现缓存和跟踪奇陈旧的缓存问题?有时,它的便宜只是升级...

But before you do, make a simple calculation: how much does an upgraded server cost vs the development and testing time you will spend implementing caching and tracking down odd stale-cache issues? Sometimes it's cheaper just to upgrade...

这篇关于何时以及如何去在asp.net mvc的表演缓存?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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