Tips and Tricks

Improving Startup Time by Sharing Packages

You can speed up how fast your "less frequently used" sites load by sharing assembles among your sites. You'll also reduce memory consumption on your server.

IIS does some wonderful things to improve your Web site's performance … not all of which improve everything about your site's performance. For example, IIS will keep the components of sites that are seeing lots of requests in memory while swapping out those sites that haven't seen requests for a while. Swapping out the components of those little-used sites also frees up memory on your server for the sites that are left running.

Unfortunately, when a request does come in for one of those less frequently used sites, that request will have to wait while IIS loads all of the site's components. This is especially annoying because those components include packages that have already been loaded by some other site (many NuGet packages, for example; Entity Framework leaps to mind). And, of course, you're now using up memory to hold multiple copies of the same component.

If you're using .NET Framework 4.5 or later, then you can use the aspnet_intern utility to help with this problem. All you have to do on your Web server is to run the command, pointing to the folder where IIS keeps its temporary files. The utility will analyze the folder and -- where it finds three or more copies of the same file -- copy the component to a new location of your choice and direct all the affected applications to use that single copy. Now, when a request comes in for an infrequently used site, IIS will use an already loaded copy of its components rather than loading them again.

Before running the utility, make sure you exercise all the sites involved to ensure the temporary folder is populated with the sites' components. Then run the aspnet_intern command, providing three parameters: mode (set to exec); sourcedir (set to the path to the Framework's temporary folder); and interndir (set to the folder where you want to keep the shared components). A typical example looks like this:

aspnet_intern -mode exec -sourcedir "C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files" -interndir C:\Prod\ShareAssemblies

If you want to see if this is worth doing, run the command, but pass "analyze" to the mode parameter. The command will print out a report showing how many shared components there are.

About the Author

Peter Vogel is a system architect and principal in PH&V Information Services. PH&V provides full-stack consulting from UX design through object modeling to database design. Peter tweets about his VSM columns with the hashtag #vogelarticles. His blog posts on user experience design can be found at http://blog.learningtree.com/tag/ui/.

comments powered by Disqus

Featured

  • Kubernetes for Developers

    Microsoft's Dan Wahlin previews his introductory "Kubernetes for Developers" session at Visual Studio Live! San Diego 2026, explaining how developers can get past the Kubernetes learning curve by starting locally, mastering Pods first, and using Services to make containerized applications reliably accessible.

  • VS Code Keeps Eye on Costs in v1.126 Update

    Visual Studio Code 1.126 adds session-level Copilot cost information, continuing Microsoft's recent focus on helping developers monitor and manage usage-based GitHub Copilot billing.

  • Open VSX 1.0.0 Puts Focus on Open Extension Registry for VS Code Ecosystem

    Eclipse Open VSX has reached 1.0.0, highlighting its role as a vendor-neutral registry for VS Code-compatible extensions.

  • Infragistics Puts MCP Toolchain at Center of Ultimate 26.1

    Infragistics Ultimate 26.1 introduces the Ignite UI Enterprise MCP toolchain for AI-assisted app development across Angular, React, Web Components and Blazor.

Subscribe on YouTube