MSDN Magazine - March 2008 - (Page 18) course, whether or not this approach should be taken can only be determined after measuring performance of cold startup with and without generated native images because the actual benefit of NGen on cold startup depends on the application code and size, so it is not guaranteed to give a significant startup improvement even if there is no JIT involved at startup time. One way to determine if and when JITing is happening is to use the Managed Debugging Assistant (MDA). JIT MDA allows you to either break into the debugger or print debug information when a method is being JITed. The MDA can be enabled by setting an environment variable, as follows: COMPLUS_MDA=JitCompilationStart In general, in order to ensure that NGen is going to benefit cold startup performance, make sure that: • The entire application is NGen-ed. • There is no rebasing. Rebasing is a very expensive operation, and rebased code cannot be shared. You can find more details on how to set the base address at msdn.microsoft.com/msdnmag/issues/06/05/CLRInsideOut. • Assemblies are installed in the Global Assembly Cache (GAC). Strong name verification requires touching the entire file, but strong name verification is skipped for all assemblies installed in the GAC. The application will break into the debugger when code is being JITed. The MDA can also be set using the registry or the application’s .config file. See the “Startup Performance Resources” sidebar for more details on how to use MDA. Authenticode Verification Startup Performance Resources The following previously published CLR Inside Out columns all contain valuable information for further investigation: Improving Application Startup Time by Claudio Caldato msdn.microsoft.com/msdnmag/issues/06/02/CLRInsideOut Includes some useful tips on how to write code in such a way that it has less impact on the application startup. The Performance Benefits of NGen by Surupa Biswas msdn.microsoft.com/msdnmag/issues/06/05/CLRInsideOut Provides a good overview of the NGen technology with a focus on performance. This article is useful for understanding the costs and benefits of using NGen when considering different scenarios such as warm startup, code sharing, cold startup, and so on. Investigating Memory Issues by Claudio Caldato and Maoni Stephens msdn.microsoft.com/msdnmag/issues/06/11/CLRInsideOut This piece is not related to startup per se, although it discusses working set, which is another important performance metric. The article covers some more advanced techniques that can be used to determine why a managed application is using too much memory. Also, you might want to check out the following articles that provide further information to help you reduce startup time: Bug Bash: Let the CLR Find Bugs for You with Managed Debugging Assistants by Stephen Toub msdn.microsoft.com/msdnmag/issues/06/05/BugBash Talks about MDAs, which are debugging aids that work with the CLR to provide information on the state of the runtime. They provide information about runtime events that you would ordinarily not be able to generate. Inside the Windows Vista Kernel by Mark Russinovich microsoft.com/technet/technetmag/issues/2007/03/VistaKernel Explains how SuperFetch operates and how ReadyBoost adds to RAM via USB without adding RAM. Signing and Checking Code with Authenticode msdn2.microsoft.com/ms537364 Gives you all the information you need to understand the Authenticode signing process. Runtime Profiling msdn2.microsoft.com/w4bz2147 Explains how to use PerMon and what the different counters mean. Assemblies can be authenticode-signed using the signcode tool. Authenticode verification always has a negative impact on startup because authenticode-signed assemblies need to be verified by a Certificate Authority (CA). The verification requires validating the CA used to sign the assemblies, which is a very expensive operation that requires network access (if the CA is not installed locally on the same machine). Ideally, you want to avoid authenticode-signing of your assemblies and use strong name signatures instead. If authenticode-signing cannot be avoided, the verification can be skipped in the .NET Framework 3.5 by using the following configuration option: Note, however, that even when authenticode-signing is necessary, most of the time required for the authentication can still be saved simply by installing the CA certificate on the client machine. Wrapping Up In order to achieve good cold startup performance, the best thing to do is to keep the code that is executed at startup time very lean. This means postponing initialization that is not strictly needed, checking all the references to make sure they are not loaded too soon and trying to use classes and methods that don’t require a lot of code to be loaded. Remember, the goal is to reduce disk access. This is not an easy task, but Xperf, a new, useful tool included in the upcoming Windows Server® 2008 SDK uses Event Tracing for Windows (ETW) to track loaded modules, context switches, and other events to help determine what happens during application startup. With XPerf it will be possible to collect very precise metrics on application startup time. The “Startup Performance Resources” sidebar contains many more references that you’ll find helpful. Send your questions and comments to clrinout@microsoft.com. Claudio Caldato is a Program Manager for Performance and Garbage Collector on the CLR team at Microsoft. 18 msdnmagazine CLR Inside Out http://msdn.microsoft.com/msdnmag/issues/06/05/CLRInsideOut http://msdn.microsoft.com/msdnmag/issues/06/05/CLRInsideOut http://msdn.microsoft.com/msdnmag/issues/06/02/CLRInsideOut http://msdn.microsoft.com/msdnmag/issues/06/05/CLRInsideOut http://msdn.microsoft.com/msdnmag/issues/06/11/CLRInsideOut http://msdn.microsoft.com/msdnmag/issues/06/05/BugBash http://microsoft.com/technet/technetmag/issues/2007/03/VistaKernel http://msdn2.microsoft.com/ms537364 http://msdn2.microsoft.com/w4bz2147
Table of Contents Feed for the Digital Edition of MSDN Magazine - March 2008 MSDN Magazine - March 2008 Contents Toolbox CLR Inside Out Data Points Advanced Basics Office Space Introducing ASP.NET MVC Loosen Up CI Server Performance Office Development Test Run Security Briefs Extreme ASP.NET Foundations .NET Matters {End Bracket} MSDN Magazine - March 2008 MSDN Magazine - March 2008 - (Page Intro) MSDN Magazine - March 2008 - Contents (Page Cover1) MSDN Magazine - March 2008 - Contents (Page Cover2) MSDN Magazine - March 2008 - Contents (Page 1) MSDN Magazine - March 2008 - Contents (Page 2) MSDN Magazine - March 2008 - Contents (Page 3) MSDN Magazine - March 2008 - Contents (Page 4) MSDN Magazine - March 2008 - Contents (Page 5) MSDN Magazine - March 2008 - Contents (Page 6) MSDN Magazine - March 2008 - Contents (Page 7) MSDN Magazine - March 2008 - Contents (Page 8) MSDN Magazine - March 2008 - Contents (Page 9) MSDN Magazine - March 2008 - Contents (Page 10) MSDN Magazine - March 2008 - Toolbox (Page 11) MSDN Magazine - March 2008 - Toolbox (Page 12) MSDN Magazine - March 2008 - Toolbox (Page 13) MSDN Magazine - March 2008 - Toolbox (Page 14) MSDN Magazine - March 2008 - CLR Inside Out (Page 15) MSDN Magazine - March 2008 - CLR Inside Out (Page 16) MSDN Magazine - March 2008 - CLR Inside Out (Page 17) MSDN Magazine - March 2008 - CLR Inside Out (Page 18) MSDN Magazine - March 2008 - CLR Inside Out (Page 19) MSDN Magazine - March 2008 - CLR Inside Out (Page 20) MSDN Magazine - March 2008 - Data Points (Page 21) MSDN Magazine - March 2008 - Data Points (Page 22) MSDN Magazine - March 2008 - Data Points (Page 23) MSDN Magazine - March 2008 - Data Points (Page 24) MSDN Magazine - March 2008 - Data Points (Page 25) MSDN Magazine - March 2008 - Data Points (Page 26) MSDN Magazine - March 2008 - Advanced Basics (Page 27) MSDN Magazine - March 2008 - Advanced Basics (Page 28) MSDN Magazine - March 2008 - Advanced Basics (Page 29) MSDN Magazine - March 2008 - Advanced Basics (Page 30) MSDN Magazine - March 2008 - Advanced Basics (Page 31) MSDN Magazine - March 2008 - Advanced Basics (Page 32) MSDN Magazine - March 2008 - Office Space (Page 33) MSDN Magazine - March 2008 - Office Space (Page 34) MSDN Magazine - March 2008 - Office Space (Page 35) MSDN Magazine - March 2008 - Office Space (Page 36) MSDN Magazine - March 2008 - Office Space (Page 37) MSDN Magazine - March 2008 - Office Space (Page 38) MSDN Magazine - March 2008 - Office Space (Page 39) MSDN Magazine - March 2008 - Office Space (Page 40) MSDN Magazine - March 2008 - Office Space (Page 41) MSDN Magazine - March 2008 - Introducing ASP.NET MVC (Page 42) MSDN Magazine - March 2008 - Introducing ASP.NET MVC (Page 43) MSDN Magazine - March 2008 - Introducing ASP.NET MVC (Page 44) MSDN Magazine - March 2008 - Introducing ASP.NET MVC (Page 45) MSDN Magazine - March 2008 - Introducing ASP.NET MVC (Page 46) MSDN Magazine - March 2008 - Introducing ASP.NET MVC (Page 47) MSDN Magazine - March 2008 - Introducing ASP.NET MVC (Page 48) MSDN Magazine - March 2008 - Introducing ASP.NET MVC (Page 49) MSDN Magazine - March 2008 - Introducing ASP.NET MVC (Page 50) MSDN Magazine - March 2008 - Introducing ASP.NET MVC (Page 51) MSDN Magazine - March 2008 - Introducing ASP.NET MVC (Page 52) MSDN Magazine - March 2008 - Introducing ASP.NET MVC (Page 53) MSDN Magazine - March 2008 - Loosen Up (Page 54) MSDN Magazine - March 2008 - Loosen Up (Page 55) MSDN Magazine - March 2008 - Loosen Up (Page 56) MSDN Magazine - March 2008 - Loosen Up (Page 57) MSDN Magazine - March 2008 - Loosen Up (Page 58) MSDN Magazine - March 2008 - Loosen Up (Page 59) MSDN Magazine - March 2008 - Loosen Up (Page 60) MSDN Magazine - March 2008 - Loosen Up (Page 61) MSDN Magazine - March 2008 - Loosen Up (Page 62) MSDN Magazine - March 2008 - Loosen Up (Page 63) MSDN Magazine - March 2008 - Loosen Up (Page 64) MSDN Magazine - March 2008 - Loosen Up (Page 65) MSDN Magazine - March 2008 - Loosen Up (Page 66) MSDN Magazine - March 2008 - Loosen Up (Page 67) MSDN Magazine - March 2008 - Loosen Up (Page 68) MSDN Magazine - March 2008 - Loosen Up (Page 69) MSDN Magazine - March 2008 - CI Server (Page 70) MSDN Magazine - March 2008 - CI Server (Page 71) MSDN Magazine - March 2008 - CI Server (Page 72) MSDN Magazine - March 2008 - CI Server (Page 73) MSDN Magazine - March 2008 - CI Server (Page 74) MSDN Magazine - March 2008 - CI Server (Page 75) MSDN Magazine - March 2008 - CI Server (Page 76) MSDN Magazine - March 2008 - CI Server (Page 77) MSDN Magazine - March 2008 - CI Server (Page 78) MSDN Magazine - March 2008 - CI Server (Page 79) MSDN Magazine - March 2008 - CI Server (Page 80) MSDN Magazine - March 2008 - Performance (Page 81) MSDN Magazine - March 2008 - Performance (Page 82) MSDN Magazine - March 2008 - Performance (Page 83) MSDN Magazine - March 2008 - Performance (Page 84) MSDN Magazine - March 2008 - Performance (Page 85) MSDN Magazine - March 2008 - Performance (Page 86) MSDN Magazine - March 2008 - Performance (Page 87) MSDN Magazine - March 2008 - Performance (Page 88) MSDN Magazine - March 2008 - Office Development (Page 89) MSDN Magazine - March 2008 - Office Development (Page 90) MSDN Magazine - March 2008 - Office Development (Page 91) MSDN Magazine - March 2008 - Office Development (Page 92) MSDN Magazine - March 2008 - Office Development (Page 93) MSDN Magazine - March 2008 - Office Development (Page 94) MSDN Magazine - March 2008 - Office Development (Page 95) MSDN Magazine - March 2008 - Office Development (Page 96) MSDN Magazine - March 2008 - Test Run (Page 97) MSDN Magazine - March 2008 - Test Run (Page 98) MSDN Magazine - March 2008 - Test Run (Page 99) MSDN Magazine - March 2008 - Test Run (Page 100) MSDN Magazine - March 2008 - Test Run (Page 101) MSDN Magazine - March 2008 - Test Run (Page 102) MSDN Magazine - March 2008 - Test Run (Page 103) MSDN Magazine - March 2008 - Test Run (Page 104) MSDN Magazine - March 2008 - Test Run (Page 105) MSDN Magazine - March 2008 - Test Run (Page 106) MSDN Magazine - March 2008 - Security Briefs (Page 107) MSDN Magazine - March 2008 - Security Briefs (Page 108) MSDN Magazine - March 2008 - Security Briefs (Page 109) MSDN Magazine - March 2008 - Security Briefs (Page 110) MSDN Magazine - March 2008 - Extreme ASP.NET (Page 111) MSDN Magazine - March 2008 - Extreme ASP.NET (Page 112) MSDN Magazine - March 2008 - Extreme ASP.NET (Page 113) MSDN Magazine - March 2008 - Extreme ASP.NET (Page 114) MSDN Magazine - March 2008 - Extreme ASP.NET (Page 115) MSDN Magazine - March 2008 - Extreme ASP.NET (Page 116) MSDN Magazine - March 2008 - Extreme ASP.NET (Page 117) MSDN Magazine - March 2008 - Extreme ASP.NET (Page 118) MSDN Magazine - March 2008 - Foundations (Page 119) MSDN Magazine - March 2008 - Foundations (Page 120) MSDN Magazine - March 2008 - Foundations (Page 121) MSDN Magazine - March 2008 - Foundations (Page 122) MSDN Magazine - March 2008 - Foundations (Page 123) MSDN Magazine - March 2008 - Foundations (Page 124) MSDN Magazine - March 2008 - Foundations (Page 125) MSDN Magazine - March 2008 - Foundations (Page 126) MSDN Magazine - March 2008 - Foundations (Page 127) MSDN Magazine - March 2008 - Foundations (Page 128) MSDN Magazine - March 2008 - .NET Matters (Page 129) MSDN Magazine - March 2008 - .NET Matters (Page 130) MSDN Magazine - March 2008 - .NET Matters (Page 131) MSDN Magazine - March 2008 - {End Bracket} (Page 132) MSDN Magazine - March 2008 - {End Bracket} (Page Cover3) MSDN Magazine - March 2008 - {End Bracket} (Page Cover4)
For optimal viewing of this digital publication, please enable JavaScript and then refresh the page. If you would like to try to load the digital publication without using Flash Player detection, please click here.