.NET 2.0 application cold-start time [modified]
-
Let's say I have a .NET 2.0 application that needs to load about 30 different .NET 2.0 assemblies during startup. Said application is taking about 35 seconds to cold-start and about 13 seconds to warm-start under a specific environment. I am aware that these numbers are fairly typical of .NET 2.0 applications. Our company did not develop said application, but am tasked with coming up with suggestions on how to improve the cold-start performance. The reading I have done suggests that the difference in the two times is due to pages still being available in memory and not as many hard-faults (disk accesses) need to be performed to reload an assembly. Things I have identified as potential solutions are: 1. Update the minimum hardware requirements (not sure what they currently are, but the tests above were done on a 1.8 GHz P4 with 512MB RAM). The cold-start time drops from 35 to 13 seconds on my development box which is a 3.0 GHz Dual Core with 2GB RAM. Warm-start time drops from 13 seconds to 3 seconds. 2. Update the application and all its assemblies to .NET 3.5. Any idea what improvement is this likely to achieve? 3. Generate native images for the assemblies. This is a trade-off between the time needed to load larger disk images and the time required to JIT-compile a CLR assembly. Is this worth pursuing further? 4. Rebase the assemblies. Using Process Explorer from SysInternals I observed that 30 assemblies were relocated by the OS Loader. Preliminary tests indicate that the performance improvement is negligible. 5. Preload the assemblies. What this would try to achieve is to mimic a warm-start, but I'm not sure how it would have to work. If I have a pre-loader application that loads the assemblies needed by the actual application, aren't different copies of the assemblies loaded by each application into its own AppDomain? How would this help improve cold-start performance unless the assemblies are put in a common place? As you can see I'm a little confused. Help? I have gleaned most of my information online from http://msdn.microsoft.com/en-us/magazine/cc163655.aspx[^]. I look forward to hearing suggestions, ideas. Thanks.
modified on Thursday, April 30, 2009 7:41 PM
-
Let's say I have a .NET 2.0 application that needs to load about 30 different .NET 2.0 assemblies during startup. Said application is taking about 35 seconds to cold-start and about 13 seconds to warm-start under a specific environment. I am aware that these numbers are fairly typical of .NET 2.0 applications. Our company did not develop said application, but am tasked with coming up with suggestions on how to improve the cold-start performance. The reading I have done suggests that the difference in the two times is due to pages still being available in memory and not as many hard-faults (disk accesses) need to be performed to reload an assembly. Things I have identified as potential solutions are: 1. Update the minimum hardware requirements (not sure what they currently are, but the tests above were done on a 1.8 GHz P4 with 512MB RAM). The cold-start time drops from 35 to 13 seconds on my development box which is a 3.0 GHz Dual Core with 2GB RAM. Warm-start time drops from 13 seconds to 3 seconds. 2. Update the application and all its assemblies to .NET 3.5. Any idea what improvement is this likely to achieve? 3. Generate native images for the assemblies. This is a trade-off between the time needed to load larger disk images and the time required to JIT-compile a CLR assembly. Is this worth pursuing further? 4. Rebase the assemblies. Using Process Explorer from SysInternals I observed that 30 assemblies were relocated by the OS Loader. Preliminary tests indicate that the performance improvement is negligible. 5. Preload the assemblies. What this would try to achieve is to mimic a warm-start, but I'm not sure how it would have to work. If I have a pre-loader application that loads the assemblies needed by the actual application, aren't different copies of the assemblies loaded by each application into its own AppDomain? How would this help improve cold-start performance unless the assemblies are put in a common place? As you can see I'm a little confused. Help? I have gleaned most of my information online from http://msdn.microsoft.com/en-us/magazine/cc163655.aspx[^]. I look forward to hearing suggestions, ideas. Thanks.
modified on Thursday, April 30, 2009 7:41 PM
Based on the description of your problem, number 3 is where I'd start. Google "NGEN" and you'll find the command line utility that creates the native images for your assemblies.
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007, 2008