<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Mohd Abubakr's take on Web Application Performance : ASP.NET</title><link>http://blogs.msdn.com/perfdude/archive/tags/ASP.NET/default.aspx</link><description>Tags: ASP.NET</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>Microsoft Anti-Cross Site Scripting Library V3.0 Beta Performance Testing Results</title><link>http://blogs.msdn.com/perfdude/archive/2008/12/31/microsoft-anti-cross-site-scripting-library-v3-0-beta-performance-testing-results.aspx</link><pubDate>Wed, 31 Dec 2008 11:26:16 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9258246</guid><dc:creator>abubakrmohd</dc:creator><slash:comments>2</slash:comments><comments>http://blogs.msdn.com/perfdude/comments/9258246.aspx</comments><wfw:commentRss>http://blogs.msdn.com/perfdude/commentrss.aspx?PostID=9258246</wfw:commentRss><description>&lt;p align="justify"&gt;The Microsoft Anti-Cross Site Scripting Library V3.0 (Anti-XSS V3.0) is an encoding library designed to help developers protect their ASP.NET web-based applications from XSS attacks. It differs from most encoding libraries in that it uses the white-listing technique -- sometimes referred to as the principle of inclusions -- to provide protection against XSS attacks. This approach works by first defining a valid or allowable set of characters, and encodes anything outside this set (invalid characters or potential attacks). The white-listing approach provides several advantages over other encoding schemes.  &lt;p align="justify"&gt;New features in this version of the Microsoft Anti-Cross Site Scripting Library include: - An expanded white list that supports more languages - Performance improvements - Performance data sheets (in the online help) - Support for Shift_JIS encoding for mobile browsers - A sample application - Security Runtime Engine (SRE) HTTP module  &lt;p&gt;Anti-XSS V3.0 can be downloaded from &lt;a href="http://www.microsoft.com/downloads/details.aspx?familyid=051ee83c-5ccf-48ed-8463-02f56a6bfc09&amp;amp;displaylang=en"&gt;here&lt;/a&gt;. More details about Anti-XSS V3.0 can be found at &lt;a href="http://blogs.msdn.com/cisg/archive/2008/12/15/anti-xss-3-0-beta-and-cat-net-community-technology-preview-now-live.aspx"&gt;CISG's blog&lt;/a&gt;.  &lt;p align="justify"&gt;This blog post contains the results of the Performance testing of Anti-XSS V3.0. These results are also included in the Performance data sheets (in the online help) of Anti-XSS V3.0. Performance testing of the Anti-XSS library was carried out for a sample application that uses AntiXSSLibrary.dll over a varying user load. Under the same load conditions, comparisons of AntiXSSLibrary.dll were done using .NET's HttpUtility.HtmlEncode() as well as with no encoding as a baseline.  &lt;p&gt;&lt;b&gt;Sample Application Overview&lt;/b&gt;  &lt;p&gt;The sample ASP.NET application was written to take strings as input and then to output the encoded form of the string using AntiXSSLibrary.dll in the background.  &lt;p&gt;The input string applied on the sample application consisted of  &lt;p&gt;· 64 character string with all safe characters (a-z,A-Z,0-9 etc.)  &lt;p&gt;· 64 character string with approx. 25% of encoding characters  &lt;p&gt;· 128 character string with approx. 25% of encoding characters  &lt;p&gt;· 512 character string with approx. 25% of encoding characters  &lt;p&gt;· 1024&amp;nbsp; character string with approx. 25% of encoding characters  &lt;p&gt;· 64 character international string (any language like Chinese or Hebrew) with no encoded strings  &lt;p&gt;· 64 character international string (any language like Chinese or Hebrew) with 25% encoded strings  &lt;p&gt;&lt;b&gt;Performance Environment&lt;/b&gt;  &lt;p align="justify"&gt;Performance testing of the Anti-XSS library and SRE were carried out in the Microsoft ACE Performance labs. The tests were conducted using 64-Bit and 32-Bit environments. The following are the machine specifications:  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/perfdude/WindowsLiveWriter/Microsoft.0BetaPerformanceTestingResults_C3E1/clip_image002_2.gif"&gt;&lt;img style="border-right-width: 0px; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" border="0" alt="clip_image002" src="http://blogs.msdn.com/blogfiles/perfdude/WindowsLiveWriter/Microsoft.0BetaPerformanceTestingResults_C3E1/clip_image002_thumb.gif" width="528" height="205"&gt;&lt;/a&gt;&lt;/p&gt; &lt;p&gt;&lt;b&gt;Load Test Overview&lt;/b&gt;  &lt;p&gt;VSTS 2008 was used to generate a load of 200 concurrent users. The following table depicts the user load distribution:  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/perfdude/WindowsLiveWriter/Microsoft.0BetaPerformanceTestingResults_C3E1/clip_image004_2.gif"&gt;&lt;img style="border-right-width: 0px; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" border="0" alt="clip_image004" src="http://blogs.msdn.com/blogfiles/perfdude/WindowsLiveWriter/Microsoft.0BetaPerformanceTestingResults_C3E1/clip_image004_thumb.gif" width="533" height="269"&gt;&lt;/a&gt;  &lt;p&gt;Each transaction consisted of two ASP.NET requests.&amp;nbsp; For this sample application, one transaction comprised:  &lt;p&gt;1. User logs on to the homepage and enters the string  &lt;p&gt;2. The application returns the encoded version of the string  &lt;p&gt;&lt;b&gt;Load Test Results&lt;/b&gt;  &lt;p align="justify"&gt;For a 200-user concurrent load, the end-to-end transaction time for the AntiXss.HtmlEncode() (yellow "Antixss Encode" in the illustration below) encoding scenario is 3.9 milliseconds in 32-bit web server and 4.2 milliseconds in 64-bit web server. Under the same user load conditions, the end-to-end transaction time for the scenario using HttpUtility.HtmlEncode() (red "Html Encode" in the illustration below) is 3.8 milliseconds and 4.1 milliseconds for 32-bit and 64-bit web servers respectively. Hence, there is only a 0.1 millisecond delta between encoding with the AntiXss.HtmlEncode() and the .NET HttpUtility.HtmlEncode() methods.  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/perfdude/WindowsLiveWriter/Microsoft.0BetaPerformanceTestingResults_C3E1/clip_image006_2.gif"&gt;&lt;img style="border-right-width: 0px; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" border="0" alt="clip_image006" src="http://blogs.msdn.com/blogfiles/perfdude/WindowsLiveWriter/Microsoft.0BetaPerformanceTestingResults_C3E1/clip_image006_thumb.gif" width="352" height="249"&gt;&lt;/a&gt;&lt;/p&gt; &lt;p align="justify"&gt;In terms of throughput, Anti-XSS generated around 85 ASP.NET Requests/sec in the 32-bit environment. Since each transaction consisted of two ASP.NET requests, the system throughput at a 200-user concurrent load for the Anti-XSS scenario came to 42.5 Requests/sec.&amp;nbsp;&amp;nbsp; &lt;p&gt;&lt;b&gt;Performance Test Results&lt;/b&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/perfdude/WindowsLiveWriter/Microsoft.0BetaPerformanceTestingResults_C3E1/clip_image008_2.gif"&gt;&lt;img style="border-right-width: 0px; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" border="0" alt="clip_image008" src="http://blogs.msdn.com/blogfiles/perfdude/WindowsLiveWriter/Microsoft.0BetaPerformanceTestingResults_C3E1/clip_image008_thumb.gif" width="520" height="453"&gt;&lt;/a&gt;  &lt;p&gt;&lt;b&gt;Summary&lt;/b&gt;  &lt;p&gt;· The average transaction time for Anti-XSS under given conditions was obtained as 3.9 and 4.2 milliseconds on 32-bit and 64-bit web servers respectively.  &lt;p&gt;· The average delta between AntiXss.HtmlEncode() and HttpUtility.HtmlEncode() is +0.1 milliseconds per transaction.  &lt;p&gt;· On 200 User concurrent loads, the throughput of the Anti-XSS library is 42.5 and 38 requests per second on 32-bit and 64-bit web servers respectively. &lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9258246" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/perfdude/archive/tags/ASP.NET/default.aspx">ASP.NET</category><category domain="http://blogs.msdn.com/perfdude/archive/tags/performance/default.aspx">performance</category></item><item><title>Web server deadlocks - aspnet_isapi.dll</title><link>http://blogs.msdn.com/perfdude/archive/2008/09/21/web-server-deadlocks-aspnet-isapi-dll.aspx</link><pubDate>Sun, 21 Sep 2008 04:56:34 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8960318</guid><dc:creator>abubakrmohd</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/perfdude/comments/8960318.aspx</comments><wfw:commentRss>http://blogs.msdn.com/perfdude/commentrss.aspx?PostID=8960318</wfw:commentRss><description>&lt;p&gt;There are various reasons for a deadlock can occur on the web server. In this blog post, I would be pointing out the various ways to resolve aspnet_isapi.dll related deadlocks on web server. If the deadlock has occurred on the web server, you should notice a warning or error on &lt;a href="http://technet.microsoft.com/en-us/library/cc785425.aspx"&gt;Event Viewer&lt;/a&gt;.  &lt;p&gt;In one of the Apps I was working on the following was the warning message noticed on Event viewer.  &lt;p&gt;&lt;b&gt;“ISAPI ‘C:\windows\Microsoft.Net\Framework\v2.0.050727\aspnet_isapi.dll’ reported itself as unhealthy for the following reason: ‘Deadlock detected’. &lt;/b&gt; &lt;p&gt;One of the reason, a dead lock can occur on the web server is due to usage of COM Interop cross-context infertace in .NET 1.1 or .NET 2.0. However, this was not the problem on the application I was working. In case, your application is facing deadlock due to COM Interop cross-context interface, this KB articles would be helpful in resolving them.  &lt;p&gt;&lt;a href="http://support.microsoft.com/kb/921217/"&gt;http://support.microsoft.com/kb/921217/&lt;/a&gt; &lt;p&gt;&lt;a href="http://support.microsoft.com/kb/915808/"&gt;http://support.microsoft.com/kb/915808/&lt;/a&gt; &lt;p&gt;Finally, after doing a bit of research here and there, I found the correct KB article that defines my problem. Here is the cause of this deadlock.  &lt;p align="justify"&gt;&lt;em&gt;This problem might occur because ASP.NET limits the number of worker threads and completion port threads that a call can use to execute requests. Typically, a call to a Web service uses one worker thread to execute the code that sends the request and one completion port thread to receive the callback from the Web service. However, if the request is redirected or requires authentication, the call may use as many as two worker and two completion port threads. Therefore, you can exhaust the managed ThreadPool when multiple Web service calls occur at the same time. &lt;br&gt;For example, suppose that the ThreadPool is limited to 10 worker threads, and all 10 worker threads are currently executing code that is waiting for a callback to execute. The callback can never execute because any work items that are queued to the ThreadPool are blocked until a thread becomes available. &lt;br&gt;Another potential source of contention is the maxconnection parameter that the &lt;b&gt;System.Net&lt;/b&gt; namespace uses to limit the number of connections. Generally, this limit works as expected. However, if many applications try to make many requests to a single IP address at the same time, threads may have to wait for an available connection.&lt;/em&gt;&lt;/p&gt; &lt;p&gt;This excellent KB article “Contention, poor performance, and deadlocks when you make Web service requests from ASP.NET applications” &lt;a href="http://support.microsoft.com/kb/821268"&gt;http://support.microsoft.com/kb/821268&lt;/a&gt; clearly defines this problem and gives out solutions.  &lt;p&gt;If the above solutions haven’t resolved your deadlock, than you can generate a dump about your deadlock, which might reveal inner characteristics of it.  &lt;p&gt;&lt;b&gt;&lt;/b&gt; &lt;p&gt;&lt;b&gt;How to generate a dump file when ASP.NET deadlocks in IIS 6.0&lt;/b&gt; &lt;p align="justify"&gt;&lt;em&gt;IIS 6.0 has a new feature that is named Orphan Worker Process. This feature lets you inspect a process that is scheduled to be recycled before the process is terminated. The Orphan Worker Process can be used to attach a debugger to the process and to generate a dump file for investigation. &lt;/em&gt; &lt;p align="justify"&gt;&lt;em&gt;OrphanWorkerProcess tells IIS not to shutdown the worker process. IIS will leave the process running but won't send the worker process any more requests to execute. This setting lets the process stay in memory so you can jump in with tools like a debugger and see where the &lt;b&gt;deadlock&lt;/b&gt; is occurring. &lt;/em&gt; &lt;p&gt;For more details on this technique, read on the following KB article &lt;a href="http://support.microsoft.com/kb/828222/"&gt;http://support.microsoft.com/kb/828222/&lt;/a&gt;&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8960318" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/perfdude/archive/tags/IIS/default.aspx">IIS</category><category domain="http://blogs.msdn.com/perfdude/archive/tags/Deadlock/default.aspx">Deadlock</category><category domain="http://blogs.msdn.com/perfdude/archive/tags/ASP.NET/default.aspx">ASP.NET</category></item></channel></rss>