Dynamic updates of remote object without service interruption

G

Guest

I need some help regarding the mechanism to put in place to be able to
dynamically update a remote object when the assembly where it is defined is
modified, and this whitout having service interruption.

Basically what I'm missing is how do we re-expose a remote object when
assembly has changed, and this without any interruption to the callers.

I have an application that exposes a remoting object (Well known service -
Singleton or singlecall).

It works as follows:

1. Console application starts
2. Console application creates an application domain
3. Shadow copy is enabled on this application domain (so that the assembly
can be changed, it is not locked)
4. Register a HTTP channel in this appDomain.
5. It then loads a specific assembly in the newly created appDomain and
register a well known service using a type found in this assembly.
6. Use FileWatcher to be notified on assembly file change.

Later, the assembly is modified. i now want to restart the service using the
new assembly.

Currently, i just unload the appDomain, then redo step 2 to step 5. Problem
is that there is a short time where the service becomes un-available and
where requests are interrupted.

Questions: How can i restart the service without having service interruption.
The idea is to process current request with old application domain, and
forward new request to new application domain.
Then once all old requests have been processed, the old application domain
can be safely unloaded.
I think i may have to use channel sink but I'm not sure.

How can i achieve this ? I know ASP.NET is using this mechanism extensively
to handle dynamic assembly changes.
Any help, ideas, code samples, etc will be greatly appreciated
 
M

Michael Nemtsev

Hello lk,

Where is there server and who is consumer?
What if second loaded object fails? Thus u need to check the state of first
and second and then to unload the first.

I reckon, that the best idea will be creating InProc queue that keeps request
to your server, while you are reloading it.
I hope it's not 27x7 component with hi-load

l> I need some help regarding the mechanism to put in place to be able
l> to dynamically update a remote object when the assembly where it is
l> defined is modified, and this whitout having service interruption.
l>
l> Basically what I'm missing is how do we re-expose a remote object
l> when assembly has changed, and this without any interruption to the
l> callers.
l>
l> I have an application that exposes a remoting object (Well known
l> service - Singleton or singlecall).
l>
l> It works as follows:
l>
l> 1. Console application starts 2. Console application creates an
l> application domain 3. Shadow copy is enabled on this application
l> domain (so that the assembly can be changed, it is not locked) 4.
l> Register a HTTP channel in this appDomain. 5. It then loads a
l> specific assembly in the newly created appDomain and register a well
l> known service using a type found in this assembly. 6. Use FileWatcher
l> to be notified on assembly file change.
l>
l> Later, the assembly is modified. i now want to restart the service
l> using the new assembly.
l>
l> Currently, i just unload the appDomain, then redo step 2 to step 5.
l> Problem is that there is a short time where the service becomes
l> un-available and where requests are interrupted.
l>
l> Questions: How can i restart the service without having service
l> interruption. The idea is to process current request with old
l> application domain, and forward new request to new application
l> domain. Then once all old requests have been processed, the old
l> application domain can be safely unloaded. I think i may have to use
l> channel sink but I'm not sure.
l>
l> How can i achieve this ? I know ASP.NET is using this mechanism
l> extensively to handle dynamic assembly changes. Any help, ideas, code
l> samples, etc will be greatly appreciated
l>
---
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche
 
G

Guest

Michael,

The server is just this console application. I basically expose a remote
object as a web service. I found the class for that object in a specific
assembly. This assembly can change (i can have same class redefined with more
methods, method changed, etc). This should not happen very often. Consumer is
any external entity that consume the service (connect to the web service, get
the wsdl, build a proxy and call the service available).

What do you mean by "what if the second loaded object failed". When the
assembly change, i just tear down the whole appdomain. Service becomes
unavailable. Then i simply recreate the whole thing again (appdomain, load
the assembly, register the channel and the singlecall). if this failed then
i'm in trouble. Service is not available anymore.

I guess i can not really queue the requests since i may run into timeout
issue in client side, right ?
If i have any long lasting pending request, then i have to wait it to
finish, to then recreate the service and process the queue afterwards. In the
meantime, any incoming request that goes to this queue, can be stuck there
for some time.

Ideally i would like to do exactly what ASP.NET is doing. Finish processing
current request using old object. re-routing new request to new object.

This does not look too straight forward and i could not find yet anything
usefull on the web.

Let me know what you think and thank you anyway for your time and your help
 
G

Guest

Any .net Guru our there ?

Still looking for help and suggestions ?

How can i queue the incoming http request in my server ? Anybody has code
samples, good articles on the subject ?
i'm thinking maybe i can queue my request (Thanks Michael!) while creating
my new appdomain. Not sure though how to expose my object if it resides in a
different appdomain than the one where the channel is registered ?

Still lots of unknows and questions ...

Please help
 

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

Top