开发者

SSI-like feature in ASP.NET / ASP.NET MVC

This may be a heretic question in a way. We have large site where lot of pages are still in ASP. Mostly, there are not really dynamic but they include (via SSI or Server.Execute) periodically regenerated chunks of HTML. It may look like a poor man's caching, but it has been working really well and I'm guessing that Microsoft has heavily optimized IIS for this scenario.

Now, we would like to be able achieve something similar in ASP.NET / ASP.NET MVC. We will have periodically generated HTML snippets (typically hourly or so) which we would like to include into ASP.NET / ASP.NET MVC wrappers providing the main site chrome, some navigation, and possibly some other dynamic content related to the snippets. So it's a mixture, but the point is that the generated HTML are periodically re-generated by an external process mainly for performance reasons and keeping our server farm in sync.

The closest thing in ASP.NET I was able to find was:

<% Response.WriteFile("GeneratedSnippet.inc"); %>

which seems to be equivalent to the

<% Server.Execute "GeneratedSnippet.inc" %>

in ASP. It's perhaps even faster because there is no code to execute. But it's not perhaps as efficient as:

<!--#include file="GeneratedSnippet.inc" -->

As I mentioned above, I suspect that IIS has been heaving optimized to han开发者_开发问答dle SSI as well as ASP includes over the years. On the other hand, the Response.WriteFile most likely really reads the file and spits it out. Would anybody have an insight into two or some experience?

Maybe I worry too much, but most of our traffic heavy content still runs on ASP and uses lot of SSI's, and so even a little difference in Response.WriteFile may accumulate and have a visible impact.


What is you question ? :)

SSI is dead. Yes it was highly heaving optimized on SERVER SIDE, however it might not very effective to cache control in not only in server but also in browsers.

If you use too many SSI, the server will have to check all related files' modified status for each request. You cannot control HTTP headers for example Expires and ETag.

There are (too) many way provided in ASP.NET and ASP.NET MVC to control and to invalidate caches, which can give better overall performance, and more scalable design and better codes in maintainability.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜