1

I have a really annoying problem.
I have an application (.net 3.5) running within IIS7.5.
Normally when I recycle an application it takes some time the first time you surf to the application. I'm used to this behaviour so I don't mind. I think that IIS then caches the dll's needed within the application, no?
Well I have one application that runs on IIS7.5 that doesn't show this behaviour. In fact when I recycle my application the first page loads really really fast (less than a second). So does every page in the application, except for one.
After some research (about 2 days) I've found that it is due to one particulary 3rd party dll that appearantly doesn't get cached on the first load of the application. So the first time I surf to this particulary page that dll (17 mb big) is loaded, which off course takes some time (the time usually needed on first load). After this first time that page is going really fast, it's really the loading of that dll that causes the performance issue.

How can I make IIS 7.5 load all my dll's on application start?

I hope I explained it well.

To know:

  • Windows server 2008 (64 bit)
  • IIS 7.5
  • .NET 3.5
  • Virtual environment

Cheers, M.

user29964
  • 135
  • 1
  • 8

1 Answers1

2

.NET loads dll's (or assemblies as they are more usually know) lazily. Only when something that needs an assembly is about to be executed will the assembly be loaded.

Thus if the assembly is never needed, because nothing that uses it is called, it never needs to be loaded.

Richard
  • 5,324
  • 1
  • 23
  • 20
  • 1
    @SemDendoncker: it depends on the dll. Maybe it does something slow on load (timeout waiting on some resource?), or maybe need has a lot of fixups if relocated (i.e. no loaded at its preferred load address in memory)... Best answer: Talk to the developer, with a re-create sample to hand. Without knowing the implementation and details of the case (e.g. profiling, ProcMon, code review...) it is all guesses. – Richard Aug 26 '10 at 09:08
  • Thx richard, you're the best!! – user29964 Aug 26 '10 at 10:44
  • @Richard: With all due respect, Richard, but that's not really an answer to the question (Sem explains your answer in his question). I can't imagine that there isn't a solution for this. – Lieven Cardoen Sep 20 '10 at 07:41
  • 2
    @Lieven: There is a solution (I didn't include this because I assumed it was obvious): reference the dll from somewhere that will lead it to be loaded earlier in the application lifecycle (e.g. Application_Start hander). – Richard Sep 20 '10 at 08:29
  • 1
    Indeed, but starting the application will taken long then, I guess. Could the problem be that the third party dlls aren't that good (architectural, ...)? – Lieven Cardoen Sep 21 '10 at 06:44
  • 1
    @Lieven: Yes, a dll that takes a significant time to load is a problem. I would look at perhaps rebasing it (to avoid the Windows loader needing to read and apply relocations (meaning the whole dll has to be read) rather than using its preferred base address (thus is just demand paged directly). With ASP.NET allowing many apps per worker finding a consistently free address might be a problem. – Richard Sep 21 '10 at 10:00