Skip to navigation

PCPro-Computing in the Real World Printed from www.pcpro.co.uk

Register to receive our regular email newsletter at http://www.pcpro.co.uk/registration.

The newsletter contains links to our latest PC news, product reviews, features and how-to guides, plus special offers and competitions.

Real World Computing

.NET performance

Posted on 24 Apr 2006 at 11:17

Thomas Lee looks at the fundamentals of performance analysis and how you can optimise the four key resources of your PC

With a little forward planning, you can roll out new code for your ASP.NET sites in a sensible fashion, avoiding times of high site usage. Or you may decide to deploy the new application during maintenance downtime - and lay on some users to run the application and force the re-compile to happen during this maintenance window. By employing change management and release management best practices (such as those advocated by ITIL), you can reduce the performance hit caused by updates.

The NGEN utility gets automatically installed when you install the .NET CLR, and it lives in %systemroot%\Windows\Microsoft.NET\Framewrk\2.0.50727 (for the .NET 2 RTM version). To perform a JIT compilation on a module, you invoke NGEN using the Install switch. An NGET session to JIT compile my client example and display the JIT cache looks like this:

[C:\PCPRO]: ngen install client.exe

Microsoft (R) CLR Native Image Generator - Version 2.0.50727.42

Copyright (C) Microsoft Corporation 1998-2002. All rights reserved.

Installing assembly C:\PCPRO\client.exe

Compiling 1 assembly:

Compiling assembly C:\PCPRO\client.exe ...

client, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null

[C:\PCPRO\]: ngen display client

Microsoft (R) CLR Native Image Generator - Version 2.0.50727.42

Copyright (C) Microsoft Corporation 1998-2002. All rights reserved.

NGEN Roots:

C:\PCPRO\client.exe

NGEN Roots that depend on "client":

C:\PCPRO\client.exe

Native Images:

client, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null

[C:\PCPRO]:

Once NGEN has compiled the application, the native code version gets stored in a native image cache: for 32-bit computers running the .NET CLR 2 RTM this is located at %systemroot%\assembly\NativeImages_v2.0.50727_32. If you look in this folder you'll see the applications, and in particular the .NET class libraries that have been natively generated. For commercial applications, using the NGEN utility shouldn't be necessary, as the application's own setup program should do this for you automatically. However, if you're writing your own applications - particularly console or GUI applications - you may find that NGENing them provides a useful reduction of start-up time.

Caching, Caching, Caching

Caching is a simple and universally useful trick, which involves creating a copy of some data closer to the place that it will be needed. Processor manufacturers like Intel build a memory cache into each CPU chip, to reduce the number of slow main memory data fetches required, while disk manufacturers similarly introduce a disk cache to reduce the number of physical disk reads when repeatedly accessing the same data item. The .NET Framework, when combined with Internet Information Server (IIS) 6 and Windows Server 2003, provides new sets of caches you can take advantage of to improve the performance of ASP.NET applications.

The diagram here shows you the key components of an IIS 6-based web server application. Each request from a client gets sent first to a proxy server for possible servicing, and only then is sent to the web server itself (in version 6 IIS now has a kernel-mode cache that serves static HTML content). Finally, within the ASP.NET worker process there's an additional output cache that holds created pages - thus avoiding having to re-generate them - which you can apply on a page-by-page basis. All these three levels of cache are used to keep content as near to the consumer as possible, and they can benefit both static and dynamic content.

1 2 3 4 5
Be the first to comment this article

You need to Login or Register to comment.

(optional)

advertisement

Latest Real World Computing
Latest Blog Posts Subscribe to our RSS Feeds
Latest News Stories Subscribe to our RSS Feeds
Latest Reviews Subscribe to our RSS Feeds

advertisement

Sponsored Links
 
SEARCH
SIGN UP

Your email:

Your password:

remember me

advertisement


Hitwise Top 10 Website 2008