Performance Issues

Topics: User Forum
Dec 22, 2009 at 1:27 PM


Recently i started to use IIRF in my website and since then i feel the site is slower and i'm wondering if there are any known performance issues with IIRF (or maybe i'm looking in the wrong place).

For example, try to compare the loading time of this addresses:תחרות_משחקי_קונסול_2009

The first url is the friendly one, and the second is the one actually loading by the rewrite rule. i checked it and the second url loads faster.

Here is my IIRF.ini file, in case the problem is there:


IterationLimit 2
RewriteCond  %{HTTP_HOST} ^startupseeds\.com$
RedirectRule ^/(.*)$$1 [R=301,I]

#DO NOT Rewrite ShowThread.aspx calls - old calls. I'll take care from code to make sure it works OK.
RewriteRule ^/forums/ShowThread.aspx(.*)$ - [L,I] 
RewriteRule ^/forums/([^\?\/]+)/ShowThread.aspx(.*)$ /Forums/ShowThread.aspx$2 [L,I]
#DO NOT Rewrite Forum.aspx.aspx calls - old calls. I'll take care from code to make sure it works OK.
RewriteRule ^/forums/Forum.aspx(.*)$ - [L,I] 
#DO NOT Rewrite NewMessage and Edit Message
RewriteRule ^/forums/NewMessage.aspx(.*)$ - [L,I] 
#DO NOT Rewrite RSS
RewriteRule ^/forums/recentmessagesrss.aspx(.*)$ - [L,I] 
RewriteRule ^/forums/recentmessages.aspx(.*)$ - [L,I] 
RewriteRule ^/forums/search.aspx(.*)$ - [L,I] 

#DO NO Rewrite BigGeek Files
RewriteRule ^/forums/IFrameForum.aspx(.*)$ - [L,I] 
RewriteRule ^/forums/IFrameShowThread.aspx(.*)$ - [L,I] 
RewriteRule ^/forums/IForumNewMsg.aspx(.*)$ - [L,I] 

#Forum Thread Rewriting
RewriteRule ^/forums/([^\?\/]+)/t([^\?\/]+)-([^\?\/]+)/page-([^\?\/]+) /Forums/ShowThread.aspx?ri=$2&title=$3&PageIndex=$4&ForumName=$1  [L,I]
RewriteRule ^/forums/([^\?\/]+)/t([^\?\/]+)-([^\?\/]+) /Forums/ShowThread.aspx?ri=$2&title=$3&PageIndex=1&ForumName=$1  [L,I]
RewriteRule ^/forum123/t([^\?\/]+)-([^\?\/]+) /Forum123/ShowThread.aspx?ri=$1&title=$2 [L,I]
RewriteRule ^/forum0800/t([^\?\/]+)-([^\?\/]+) /0800/FreeLesson/ShowThread.aspx?ri=$1&title=$2 [L,I]

#To Enable PostBack In 0800 thread:
RewriteRule ^/forum0800/ShowThread.aspx((\?.+)|())$ /0800/FreeLesson/ShowThread.aspx$1 [L,I]

#Forum Page Rewriting
RewriteRule ^/forums/([^\?\/]+)/page-([^\?\/]+) /Forums/Forum.aspx?utitle=$1&PageIndex=$2  [L,I]
RewriteRule ^/forums/([^\?\/]+) /Forums/Forum.aspx?utitle=$1&PageIndex=1  [L,I]

#Forum List Rewriting
RewriteRule ^/forums /Forums/ForumsList.aspx  [L,I]
RewriteRule ^/forums/ /Forums/ForumsList.aspx  [L,I]

#User Profile
RewriteRule ^/UserDetails/([^\?\/]+) /UserDetails/UserDetails.aspx?username=$1  [L,I]
RewriteRule ^/users/([^\?\/]+) /UserDetails/UserDetails.aspx?normalizedusername=$1  [L,I]

I hope you can help me to fix the file in case it's the problem, or tell me if there are any known performance issues in IIRF.


Thanks a lot!



Dec 22, 2009 at 4:31 PM

I don't know of any performance "issues" in IIRF.   

For every rule you have, IIRF is doing a regular expression evaluation, and myriad memory allocations and so on.  For 20 rules, it can become expensive.  How expensive?  I don't know.  Comparing your first sample URL with the second, there is just one regex evaluation done for the ShowThread.aspx URL.  There are 10 or 11 done for the games URL.  Does this make a difference?  I don't know.  It's not FREE. 

But to get a meaningful result, you need to compare the rewritten form of a URL with the no-rewrite form, instead of comparing one rewritten URL with another rewritten URL.   

Best approach is:

  • use friendly URLs
  • use caching, for images, etc
  • use a profiler (like Fiddler) to measure and observe
  • be sure to compare like-to-like

good luck.

Dec 22, 2009 at 6:40 PM


Thank you for your answer.

In my site, the second url i gave is non-rewritten url. i really have file ShowThread.aspx in the folder Forums. so i think the results are meaningful (the only rule i apply in this case is the one in the 5th line that tell not to apply any rule... considering this information (which i forgot to write in my first message), can i make this work faster? change some rules?

In the IIS i have High priority to your ISAPI Filter and a low priority to the ASP.NET ISAPI Filter. is it good? or can i do some changes to make it better? 

And, btw, does the ISAPI Filter cache the result of the regex evaluation? i mean, after i first entered the first URL i gave, does it save somewhere in the memory the final result so it won't have to check each rule again in the next request?





Dec 22, 2009 at 7:16 PM

They are not comparable, in general.

Consider this:  URL http://server/page1 which is rewritten.  It retrieves a text file that is 256 bytes in length.  Compare this to http://server/RetrieveData.aspx, which is not rewritten.  It retrieves an html file which is 16k in length, plus 5 images, which average 8k.  Which will be faster? 

To measure the impact of IIRF, you need to compare the rewritten and unrewritten form of the same URL.

IIRF does not perform caching of regex evaluations.  It would be possible but I haven't done it.  If you have a web cache, you will be able to take advantage of it.  ASPNET 2.0 can use IIS' kernel-mode cache. 

You asked if you can make it faster - I suggest you use Fiddler to get a profile of the time consumed during a transaction, to understand where it is.


Dec 22, 2009 at 7:31 PM

I want to measure the time of the rewriting process itself. so i take the first link which has a rewrite rule and compare it to the second link which has exactly the same content (the first link actually rewrite to the second one) and check the difference. and from my tests i think the differences are significant. I understand that the rewrite has it cost, i just want to know for sure what cause the differences.

How fiddler can help me? the rewrite is on the server... it's not a redirect.

do you have any plans to include the caching in the next versions?



Dec 22, 2009 at 9:38 PM
Edited Dec 22, 2009 at 9:45 PM

I didn't realize that the two URLs you referenced pointed to the same content.

What Fiddler shows you is the cascade of requests for a particular page.  That main page results in 18-19 requests, on my machine.  Fiddler shows this.

Each one runs through the IIRF ruleset.  

I don't have any plans to add caching.  If you can quantify the performance delta, I would be more inclined to look at it. 

There are a variety of things that affect web app performance.  IIRF is one thing.  What else in your system could be optimized, and how?  Do you need all the Chat transactions?  Do you need to optimize ASPNET to use IIS caching?  Have you enabled caching for static images?  and so on.  If you could show me the relative cost of thost things and demonstrate that IIRF is holding back the rest of the platform, I'd be more interested in lookng into caching.

Dec 23, 2009 at 6:01 AM

Can i save time by defining some folders that won't run at all through all the IIRF ruleset? that IIRF simply won't be exists for them (i have folders in the application that don't use friendly URL's)?


Dec 23, 2009 at 10:41 PM

IIRF works on  per-vdir basis. (or per IIS application).   If you don't have an IIRF.ini in a vdir, then no rules are in effect (IIRF is a no-op).