IIS 重寫模塊重寫映射性能 (IIS Rewrite Module rewrite map performance)


問題描述

IIS 重寫模塊重寫映射性能 (IIS Rewrite Module rewrite map performance)

I'm writing a new site to overtake an old site and need to handle the old url redirects (w/ appropriate content migration).  I'm thinking I'd like to use rewrite maps rather than develop a bunch of regular expressions to match b/c the old site has a huge variety of strange url formats.  But, I could have up to 8,000 old urls to map and I'm worried that this might consume too many resources and slow down my site.  Anyone have any data/experience/guidance regarding rewrite map performance w/ large amounts of urls?

Thanks!


參考解法

方法 1:

The question is referring to the II7 Url Rewrite module 2.0 and the implementation of a large set of items inside a rewritemap.  Adding this as custom functionality to the 404 page is not a good design and not optimal for the request pipeline.

The rewritemap is specifically designed to handle large url collections and shouldn't be a problem as long as you have memory to hold 8k urls in addition to yoru other memory needs.  

You can easily test the server using jmeter or visual studio to see if the rewritemap size has any significant impact on response time.

方法 2:

I have implemented a URL redirect mechanism on more than one occasion; i've mostly used the 404 handler for this (as this does not incur an overhead penalty for the new URLs); if a request triggers the 404 handler see if it's not actually a redirect; if it is send 301 else send 404.

Redirects can be stored in an indexed lookup (like a Dictionary in c#) which guarantees near constant-time lookup performance for the size you're indicating (8k entries).

Alternatives could be using an HttpModule or (ugh) ISAP filters but your "404 aspx error page" is the most straightforward and easiest to implement.

As for performance; this is a proven solution for a site with 9M+ hits/day.

(by skeejDeveliciousBjørn van Dommelen)

參考文件

  1. IIS Rewrite Module rewrite map performance (CC BY-SA 3.0/4.0)

#url-rewriting #iis-7.5 #iis-7






相關問題

靜態內容域的 IIS 重定向規則 (IIS redirect rules for static content domains)

IIS 重寫模塊重寫映射性能 (IIS Rewrite Module rewrite map performance)

我返回集合的 Asp.net mvc 操作生成包含 system.linq.Enumerable 的 url,如何刪除它們 (My Asp.net mvc actions that return collection generate urls containing system.linq.Enumerable, how to remove them)

如何將查詢參數修改為路徑文件夾名稱? (How to mod_rewrite a query parameter to a path folder name?)

如何使用 .htaccess 將動態 URL 更改為 SEO 友好 (how to change the dynamic URL to SEO friendly using .htaccess)

AngularJS 和 URL 重寫為 HTTPS (AngularJS and URL Rewrite to HTTPS)

mod-rewrite 結合了兩種不同的重寫規則 (mod-rewrite combine two different rewrite rules)

htaccess 刪除 .php 擴展名並重寫為 www (htaccess remove .php extension and rewrite to www)

初學者 Apache URL 重寫問題 (Beginner Apache URL Rewrite Question)

.net datapager + listview + Intelligencia.UrlRewriter (.net datapager + listview + Intelligencia.UrlRewriter)

jquery get / post請求的Apache url替換 (Apache url replacement for jquery get / post request)

在python中解析url以提取參數 (Parsing url in python to extract parameters)







留言討論