缓存是一个好主意吗?如果是这样,在哪里? [英] Is caching a good idea? If so, where?

查看:105
本文介绍了缓存是一个好主意吗?如果是这样,在哪里?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个asp.net网站用了一天(节假日前超过60K峰)10-25k游客。页/访问也很高,因为它是一个内容网站。
我有生成流量的60%左右的几个特定网页。这些页面是有点复杂的,是沉重的DB(SQL Server 2008 R2的后端)。
我想知道它是否值得缓存这些页面的静态版本(我听说这是可能的),只有当事情(在48hs每一次)改变重新渲染它们。
这听起来像一个好主意?哪里将是实现这个最好的地方?
(asp.net,IIS,DB)

I have an asp.net web site with 10-25k visitors a day (peaks of over 60k before holidays). Pages/visit is also high, since it's a content site. I have a few specific pages which generate about 60% of the traffic. These pages are a bit complex and are DB heavy (sql server 2008 r2 backend). I was wondering if it's worth "caching" a static version of these pages (I hear this is possible) and only re-render them when something changes (about once in 48hs). Does this sound like a good idea? Where would be the best place to implement this? (asp.net, iis, db)

更新:看起来像我的一个很好的选择是使用的OutputCache的SqlDependency。我看到缓存无效某种的SQL Server通知的引用,但我只看到SQL Server 2005的谈话有这个选项被撤销$ P $微软pcated?处理这个任何新的方式?

Update: Looks like a good option for me is outputcache with SqlDependency. I see a reference to some kind of SQL server notification for invalidating the cache, but I only see talk of SQL server 2005. Has this option been deprecated by Microsoft? Any new way to handle this?

推荐答案

缓存是一个广义的术语,可以在多个不同的点发生。最佳的解决方案可以是部分或全部的组合。

Caching is a broad term that can happen at a number of different points. The optimum solution may be a combination of some or all.

例如,您可以添加页面,或者输出缓存所描述的这里,该缓存Web服务器,我认为在输出你指的是什么。

For example, you can add page, or output caching as described here, which caches output on the web server, which I think is what you were referring to.

此外,您可以在内存使用像 memcached的,让你的数据更适用于缓存中的数据Web服务器因为它建立了网页,但你需要看看缓存的命中率肯定知道你是缓存正确的数据。

In addition, you can cache the data in memory using something like memcached, so that your data is more available to the web server as it builds the page, but you need to look at cache hit rate to know for sure that you are caching the right data.

此外,虽然稍微偏提高分贝重页的题目,你可以缓存很少更改像图片,CSS静态资源,包括使用内容交付网络文件。任何CDN几乎可以肯定将有一个更高的带宽和比你自己的,因为规模经济的连接更便宜的数据计划,让你的内容越多,你可以从那里,更好地服务于一般

Also, although slightly off the topic of improving db heavy pages, you can cache static resources that change infrequently like images, css and include files using a content delivery network. Any CDN will almost certainly have a higher bandwidth and a cheaper data plan than your own connection because of the economies of scale, so the more of your content you can serve from there the better, in general.

您的第一个问题是:我在想,如果它的价值缓存这些页面的静态版本。我想这个问题的答案取决于是否有是目前性能问题,而且该问题的原因是。如果正在快速可靠地送达页面,则很可能是不值得实现缓存。如果有性能问题,又在哪里呢?它是在数据库读取时间,或者是花费在建设页面一旦数据已经回来了?时间

Your first question was "I was wondering if it's worth "caching" a static version of these pages". I guess the answer to that depends on whether there is a performance problem at the moment, and where the cause of that problem is. If the pages are being served quickly and reliably, then quite possibly it's not worth implementing caching. If there is a performance problem, then where is it? Is it in db read time, or is it in the time spent building the page once the data has been returned?

这篇关于缓存是一个好主意吗?如果是这样,在哪里?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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