Enterprise Library Test Guide - Willy .Net
Enterprise Library Test Guide - Willy .Net
Enterprise Library Test Guide - Willy .Net
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
234<br />
<strong>Enterprise</strong> <strong>Library</strong> <strong>Test</strong> <strong>Guide</strong><br />
Results showed that, for the tests that used 20 KB values, the 32-bit computer started<br />
paging because there was insufficient memory to hold all the data. The Pages/Sec<br />
performance counter went up between 160 pages/sec and 170 pages/sec. The % Processor<br />
Time performance counter fell far below capacity. Generally, it was no higher<br />
than 34 percent. The Private Bytes performance counter for the ASP.NET w3wp.exe<br />
worker process was close to 1.7 GB.<br />
For the 64-bit computer, it was possible to use values that were as large as 30 KB<br />
while still maintaining acceptable levels for both response times and transactions per<br />
second. During the heaviest load, the Private Bytes performance counter was at approximately<br />
5 GB. There was little contention. The CLR contention rate/sec indicated<br />
values less than 8 and the Pages/sec performance counter was zero.<br />
Measuring Initialization Costs<br />
The initialization cost is the amount of system resources and time necessary to prepare<br />
an application block so that it can begin to execute requests. Subsequent costs<br />
will be much less because the necessary code and data structures are now cached.<br />
This measurement is not relevant for Web applications because the first hit (the<br />
initialization process) is not considered an important factor in terms of performance.<br />
However, the measurement does matter for smart client applications because clients<br />
frequently stop and restart the application. This means that clients will repeatedly<br />
initialize the code variables and data structures.<br />
The .NET Framework XmlSerializer class, which <strong>Enterprise</strong> <strong>Library</strong> uses, illustrates<br />
this. The initialization cost is high because the class must be compiled. Afterward, the<br />
compiled version is in the cache.<br />
For situations where the initialization cost is important, you should measure the<br />
times it takes to execute the most expensive execution paths. To do this, write a test<br />
console application that measures and displays the initialization costs. The following<br />
code shows how to do this for the XmlSerializer class.<br />
public class OrderedItem<br />
{<br />
public string Nationality;<br />
public string Description;<br />
public decimal UnitPrice;<br />
public int Quantity;<br />
}<br />
class Class1<br />
{<br />
[STAThread]<br />
static void Main(string[] args)<br />
{<br />
for(int i=0;i