Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / April 2008

Tip: Looking for answers? Try searching our database.

Anything Wrong With "preloading" Assemblies?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Robert Cramer - 20 Apr 2008 09:28 GMT
I am needing to create a sort of "plug-in architecture" whereby different
Web sites I maintain on the same server have slightly different
functionality. Some Web sites will need to use the functionality in some
assemblies, while others will get similar functionalilty from different
assemblies.

What I was thinking about doing - and I'd apprecaite your feedback on this -
is to load the assemblies required by a particular site into the site's
default application domain, and do this loading during Application_Start. I
would load the assemblies via Reflection (e.g., Assembly.Load()).

Two benefits of doing it this way:
1. I can have all the logic in one place... this is the logic that
determines which assemblies to load for the current site.

2. A minor benefit is that when members from a given assembly are eventually
required, the assembly is already loaded, thereby helping with runtime
performance.

Are there any significant downsides to doing it this way, or reasons I
should not preload these assemblies? Any "gotchas" I should account for?

Thanks!
Holger Kreissl - 20 Apr 2008 10:47 GMT
Hello Robert

i dont see any problems here. The only thing to discuss is the preload
instead of load on demand. But that depends on your specific
architecture. But i am looking forward to read some other opinions about
that.
Greetings,
holger

> I am needing to create a sort of "plug-in architecture" whereby different
> Web sites I maintain on the same server have slightly different
[quoted text clipped - 19 lines]
>
> Thanks!

Signature

Holger Kreissl
.NET Software Developer
http://kreissl.blogspot.com/

Robert Cramer - 20 Apr 2008 16:39 GMT
<snip>

RE:
<< The only thing to discuss is the preload instead of load on demand. But
that depends on your specific architecture >>

In my case I have a few HTTP handlers per Web site that are not traditional
.ASPX pages (they don't even inherit Page). It is the selection of the
particular subset of special handlers [to load for a given site] that I
would like to perform during Application_Start. For me this selection is the
primary motivation. I have to do it somewhere and would prefer to NOT run
that logic potentially many times, which would be the case if I were to go
with a load-as-needed implementation. The performance of having them pre
loaded is of secondary importance, although it's certainly a benefit.

-RC
Alvin Bruney [ASP.NET MVP] - 20 Apr 2008 23:03 GMT
I'm not all warm and fuzzy about this approach to tell you frankly. I think
your working set will grow large which will result in page faults and
performance issues. You can't really unload an assembly so it sits around
hogging memory and resources. Anyway you go with modern code would isolate
the logic so your benefit in item 1 is not a distinct advantage.

I'd suggest a redesign to work around the working set issue. Use inheritance
and a class hierarchy to 'point' to the functionality. When it is required,
you would load it inside an app domain. app domains can be unloaded and are
a lot lighter than assemblies so essentially, you would have one assembly
that knows where the functionality of each plug in is.

Signature

Regards,
Alvin Bruney [MVP ASP.NET]

[Shameless Author plug]
The O.W.C. Black Book, 2nd Edition
Exclusively on www.lulu.com/owc $19.99
-------------------------------------------------------

> I am needing to create a sort of "plug-in architecture" whereby different
> Web sites I maintain on the same server have slightly different
[quoted text clipped - 20 lines]
>
> Thanks!
Peter Bromberg [C# MVP] - 21 Apr 2008 01:25 GMT
This  --
http://www.eggheadcafe.com/articles/20041204.asp  
--might give you some ideas along this line of thought. The original concept
was developed by my friend and fellow MVP, J. Ambrose Little.
-- Peter
To be a success, arm yourself with the tools you need and learn how to use
them.

Site: http://www.eggheadcafe.com
http://petesbloggerama.blogspot.com
http://ittyurl.net

> I am needing to create a sort of "plug-in architecture" whereby different
> Web sites I maintain on the same server have slightly different
[quoted text clipped - 19 lines]
>
> Thanks!

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.