.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.
advertisement
- Getting to grips with Microsoft's IT Health Environment Scanner
- Virtualise your servers
- The changing face of travel gadgets
- Build your own distributed file system
- The bulletproof Dell that costs an arm and a leg
- Microsoft Office 2010 Technical Preview: Q&A
- Lawnmowers, the TyTN II and one odd insurance request
- There'll never be a bulletproof OS
- How far can we trust apps?
- Five nice touches in Outlook 2010
- Why Britain's watchdogs have fewer teeth than goldfish
- Tabbed documents: how to make Office 2010 great
- Outlook 2010 People Pane – does it spell death to Xobni
- Microsoft Outlook 2010 screenshots
- Co-Authoring in Word 2010 and SharePoint Foundation 2010
- Microsoft Outlook 2010 screenshots: Backstage view
- Flash 10.1: Developing for Desktop and Device
- Microsoft Office 2010 screenshots: Recover unsaved items
- Microsoft Word 2010 screenshots: Text Effects
- Microsoft Word 2010: inserting screenshots
- Windows 8 set for 2012 release
- Q&A: Why Conficker was a victim of its own success
- App developers losing faith in Android
- Biz Stone: Murdoch's Google veto will "fail fast"
- Google adds automatic captions to YouTube
- China ramps up cyber spying
- Mozilla maintains dependence on Google
- Windows 7 flying off the shelves
- Google Chrome OS: full details unveiled
- AOL slashes 2,500 jobs
advertisement
Printed from www.pcpro.co.uk


