Global assembly cache and memory

J

Jerry Morton

Hi,
My ASP.NET application will be installed on multiple web sites on one
server. This means that the application DLL will be loaded once for
each installation - which seems inefficient. If I install the DLL in
the Global Assembly Cache, I know it only exists in one place on disk
but does it also mean it is only loaded in memory ONCE on the server,
with each installation using the same in-memory copy? Are there any
security issues or other conflicts with this (I need each site to have
it's own worker process, file access, etc.)?

Will I still have to install the actual ASP pages on each site?

Thanks.
 
J

Jerry Morton

Hi,
Thanks for the link - some detailed info there. I know there's not
always an "easy" answer to questions like this and it depends on
exactly what I'm trying to do.

My app uses static variables and singleton objects extensively -
Junfeng Zhang's blog says these are internal to appdomains.
(I assume "appdomain = application instance"? i.e. per website). Other
discussions suggest (I think) that static data is shared (i.e. stored
once per server!?). This would cause problems for me.

I always had the "simple" (but possibly outdated) view:

For a individual application:
1) DLL exists on disk!
2) DLL is loaded into memory and NEVER changes (unless self-modifying
code is used!)
3) Every VARIABLE, OBJECT, etc., regardless of its
public/private/static/singleton/session/whatever status, is unique to
the application instance.

So, if you put the DLL into the GAC then why can't the actual CODE
exist only ONCE in memory with extra memory for each application
instance to store its own state?

I thought the GAC was:

1) an answer to saving disk space (like DLL's used to be)
2) a central place to JIT code so that each application doesn't have
to do it
3) a centralised store to ensure consistent software updates and
side-by-side versioning

I wrote my application to be completely independent on each site but
now it seems I can't use the efficiencies of the GAC because my app
won't be so "separate" between instances?

Dazed and confused :)
 
S

Scott Allen

Hi Jerry:

Each ASP.NET web application will live in an appdomain dedicated to
the web app. There can be mutiple appdomains inside of a single
process, so a single asp.net worker process may host several
applications. Still - since static variables are scoped to a single
appdomain - each web application would have it's own single instance
of a static.

Don't worry about static variables being shared across the machine or
across web applications - it definetly does not work that way!

HTH,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,535
Members
45,008
Latest member
obedient dusk

Latest Threads

Top