Showing posts with label ARR. Show all posts
Showing posts with label ARR. Show all posts

Friday, June 27, 2014

IIS ARR Reverse Proxy and HTTP Status Code 304

In IIS 7.5, reverse proxy using ARR v2, does not send 304 status code for subsequent requests which are cached on file system. Because of this, even if the actual website allows caching of requests in browser (client side), ARR always sends HTTP 200 code. This forces the browser to download the cached request again from server.

For some strange reason, ARR always send status code 200 if requests contains ETags.
So, basically if you want ARR to send 304 status code then ETags must be removed.

In IIS, Etags can be removed from response with the help IIS URL Rewrite module. Following outbound rule must be created to remove ETags:

<outboundrules>
  <rule name="Remove ETag">
    <match pattern=".+" servervariable="RESPONSE_ETag">
    <action type="Rewrite" value="">
  </action></match></rule>
</outboundrules>

For more details check below links:
http://stackoverflow.com/questions/24381694/iis-7-5-and-arr-304-status-code-not-sent-for-images
http://forums.iis.net/t/1213330.aspx?ARR+Disk+cache+return+200+instead+of+304+for+cached+files

Friday, April 5, 2013

Improve Sitecore Media Library Performance with IIS ARR

Recently one of our Sitecore production environment was having performance issues. On troubleshooting we found that one of the causes was media library. It was performing poorly when there was heavy load on the server. Even after configuring various media library related settings in web.config, performance was not getting improved. We were still observing CPU spikes in production environment.

Due to budget constraints, CDN option was ruled out for media library. Then we came up with a solution to have a proxy before the CD server. We found that reverse proxy can be setup with help of IIS Application Request Routing and URL Rewrite.

After setting up reverse proxy, all media library requests were forwarded to CD server for the first time and its response was cached on disk. After creation of cache, media library request were not forwarded to CD server and instead were being served from cache.

When we performed load testing on our Staging environment, there was vast improvement in performance with ARR cache. CPU Utilization reduced by almost 10x times, Requests/Sec increased by 1.5x times and Response Time reduced to half.

Till now we haven't seen any functionality issues in Sitecore websites with ARR caches. All sites were working fine as expected.

One important setting to be configured in web.config file is to set HTTP Cache-Control Header to Public for media library files. This will enable media library items to get cached at proxy sites.
<setting name="MediaResponse.Cacheability" value="public" />

There are other ways as well to improve media library performance but more on that in later posts.