4

I'm trying to debug a problem in our ASP.Net application, whereby the first page access can take up to five minutes. This site runs in .Net 3.5 and has 100 ascx controls and 25 aspx pages, so it's not small.

What I've noticed is that when the site is really slow to load the Temporary ASP.Net files folder is being repopulated. Fully loaded and running that folder is ~ 50 to 70 MB total, with anywhere from 2000-3000 files in it.

I'm a little confused as to how and when that folder is cleared out? Starting from scratch with an empty folder the site takes 5 minutes to load. But under regular recompilations, maybe a file or two changed, the site comes up in 30 seconds after a rebuild.

What I don't understand is when the folder is cleared out-- sometimes even after I run a clean and rebuild all on the solution, with an iisreset and web.config change thrown in for good measure, that folder has nearly the same number of files as before when the site reloads and it only takes 30 seconds to come up. (We are using the 'optimizeCompilations' flag in web.config)

Other times, under other build circumstances I can't explain, we're back to the 5 minute load times as the folder completely rebuilds itself.

When is this folder cleared out and is there anything I can do to speed up its repopulation time when it needs to start from scratch? (70 megabytes in 5 minutes seems a little slow?)

larryq
  • 15,713
  • 38
  • 121
  • 190
  • Pages are translated to code only on demand. I can't believe then that your very first request involves ALL pages and ALL controls on them so that everything is compiled at once. It is just impossible. Rather, if you purge the temp folder completely, you should see only these files that correspond to the very first request. And under none circumstances should this take 5 minutes. There is probably something else happening which you do not mention or you do not realize. – Wiktor Zychla Feb 28 '13 at 19:34
  • @Wiktor Zychla: Are you sure the pages are only compiled on demand, and not everything is compiled at once, on first access? When I wipe out the Temporary ASP.Net folder and access my site for the first time, the entire folder is recreated, with about 1800 entries. Perhaps there's a compilation flag that determines one way or another? – larryq Feb 28 '13 at 20:43
  • I am 99% sure. Ade you sure that there is no hacky code somewhere in the application startup to actually force the full recompilation? – Wiktor Zychla Feb 28 '13 at 21:11
  • Nothing I'm aware of. The MSDN documentation on this seems to indicate too that the entire app is recompiled on startup too-- http://stackoverflow.com/questions/450831/what-is-the-temporary-asp-net-files-folder-for?rq=1 – larryq Mar 01 '13 at 16:28
  • Similarily to the answer in the question you linked, we host plenty of large apps and never had problems with recompilation. This always takes seconds rather than minutes. I would suggest an experiment, deploy your app but do not connect to it. Rather, force the recompilation with the aspnet_compiler -v. Measure the time and post it. This way we will know whether it is the recompilation only or rather a custom code that slows down the first request. – Wiktor Zychla Mar 01 '13 at 17:06

1 Answers1

0

Are you sure your not doing anything whizzy on startup such as precompiling the entire site?

Search you code base for something like this:

aspnet_compiler -p

Also check your global.asax file to see what your doing on startup?

George Filippakos
  • 16,359
  • 15
  • 81
  • 92
  • **aspnet_compiler -p** or ***compilation debug="false" targetFramework="4.5.1" defaultLanguage="C#" optimizeCompilations="true" batch="true" maxBatchGeneratedFileSize="2147483647" maxBatchSize="2147483647" numRecompilesBeforeAppRestart="2147483647*** – Kiquenet Jul 09 '15 at 07:42