krolik
krolik

Reputation: 5802

Performance issues with .net application running from network share

I have a problem with Windows Forms (.net 4) application. One of our clients wants to run it from network share (our app can be used by 20-300 users at the same time). We were able to get it to work by adding this line to app.config

<loadFromRemoteSources enabled="true" /> 

It takes a moment to start the program and after a while users can work. Unfortunately they noted that when the application is not used for some time and they want to use it again, the response is very slow (it takes about 1-3 minutes to 'wake up' the app). At least that's what I've heard from our consultant.

I'll probably see it myself on next Monday, but first of all I would like to know:

  1. Is this behavior normal, and if so, why?
  2. What tools should I use to investigate this issue?

Upvotes: 4

Views: 1937

Answers (1)

arx
arx

Reputation: 16904

For unmanaged exes, if an application hasn't been used for a while it gets paged out. Pages containing code are simply discarded because they can be reloaded from the exe or dll. When you start using the application again it gets paged in and this takes a while. If the app is running from a network share, this paging-in will happen over the network and can be very slow. It can be avoided by setting the IMAGE_FILE_NET_RUN_FROM_SWAP flag (using editbin /swaprun:net).

C# apps are a bit more complicated. The exe and dlls are still memory-mapped, but all the code is generated at run-time from the IL. This JITted code will be paged to the local page file, but I guess that any resources or metadata will be discarded, and paged-in on demand from the network. Which may account for the slowness.

But rather than speculating, run procmon and see what your app is doing.

Upvotes: 4

Related Questions