[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Jay Callas

9/11/2004 8:18:00 PM

I have a project in which a series of business objects (windows controls)
related to stock trading are being hosted in a "launcher" application. Using
a config file, the launcher app displays a toolbar with a series of buttons.
Each button represents another window that can be opened that hosts a
specific control (market monitor, trade entry, order editor, etc.).

In order to to provide security against the entire application crashing I
created two executables. (We want to guarentee that if one business object
crashes it does not leave the trader with nothing else to work with.) The
launcher is one of the executables and an object viewer is another. Every
time a button is clicked the launcher starts up another copy of the viewer
passing in the assembly and class name. The viewer then uses reflection to
create an instance of the control and displays it. All running instances of
the executables for a given trader are running on the same physical system.
On a given system there is a single instane of the launcher and multiple
instances of the viewer.

Now to the crux of my question.

I need to provide two-way communication between the launcher and each
instance of the viewer. (I would also love communcation between viwers, but
could just use the launcher as a relayer.) Types of information passed back
and forth would be config settings, symbol subscription requests, start/stop
requests, new business object creation requests, etc.

Is remoting the answer to this two-way communication? Would I create a
singleton launcher? Should I be looking at creating different AppDomains? I
have read that communications between different AppDomains in the same
process is faster than communications between different process. (Problem
with that is the single process. I guess that could crash and take
everything down.)

To take this further. What would happen if I wanted to run this application
on a terminal server? Multiple traders each with their own launcher and set
of viewers? I would guess that making the launcher a singleton would keep
that from happening.

Any info would be appreciated.

Thanks,
Jason


2 Answers

Ken Kolda

9/13/2004 3:35:00 PM

0


"Jay Callas" <JayCallas@hotmail.com> wrote in message
news:ue7okxDmEHA.2380@TK2MSFTNGP14.phx.gbl...
>
> I need to provide two-way communication between the launcher and each
> instance of the viewer. (I would also love communcation between viwers,
but
> could just use the launcher as a relayer.) Types of information passed
back
> and forth would be config settings, symbol subscription requests,
start/stop
> requests, new business object creation requests, etc.
>
> Is remoting the answer to this two-way communication?

Remoting could certainly be a way to do this. I would imagine your launcher
would act as the remoting server and, each time it launched a viewer, it
would pass it as a command line argument the port on which it is receiving
remoting requests (i.e. on which you registered the TcpChannel). You'll need
to do this to support terminal services since you could have multiple
launcher processes running concurrently which can't all listen on the same
port.

The viewer would then user Activator.GetObject() to fetch some server object
from the launcher and they'd communicate back and forth from there.

Another, cheesier alternative which may satisfy your needs depending on what
kinds of messages you have to send back and forth, is to use the standard in
and out of the viewer process for messaging. This would really only be
appropriate if all of your messages are one-way (i.e. don't require a
response from the receiver). If you need two-way messaging (i.e. actual
remote object calls), stick with remoting.

> Would I create a singleton launcher?

By singletone here I assume you mean an app for which only one instance can
be running at a time. In this case, I'd say no -- there's really no need. If
the launcher passed the necessary channel info to its viewers, then they
will communicate only with it. So, multiple launcher/viewer sets could
coexist without a problem.

> Should I be looking at creating different AppDomains? I
> have read that communications between different AppDomains in the same
> process is faster than communications between different process. (Problem
> with that is the single process. I guess that could crash and take
> everything down.)
>

Using remoting between AppDomains in a single process should be faster.
Whether that really matters or not depends on how much data you're pumping
between the launcher and viewer. If you're just passing small bit of info
back and forth, I wouldn't worry about this performance difference.

As for process isolation, the two AppDomains should, ideally, run mostly
independently. You could start up your viewers in AppDomains inside the same
process as the Launcher and, ideally, if the viewer crashes, only that
AppDomain is affected. However, there are two kinds of crash: one which is
caused by an unhandled exception your code and one which is caused by .NET
performing an illegal operation and crashing. Using AppDomains instead of
separate processes protects you against the first type of crash but not the
latter.

> To take this further. What would happen if I wanted to run this
application
> on a terminal server? Multiple traders each with their own launcher and
set
> of viewers? I would guess that making the launcher a singleton would keep
> that from happening.
>

As I mentioned above, I wouldn't worry about trying to prevent multiple
instances of your app. I don't see that it's necessary or advantageous.

Regards -
Ken


Jay Callas

9/13/2004 4:51:00 PM

0

Thank you Ken for responding. Your answer was extremely helpful.

- Jason

"Ken Kolda" <ken.kolda@elliemae-nospamplease.com> wrote in message
news:%23hwtQdamEHA.2788@TK2MSFTNGP10.phx.gbl...
>
> "Jay Callas" <JayCallas@hotmail.com> wrote in message
> news:ue7okxDmEHA.2380@TK2MSFTNGP14.phx.gbl...
>>
>> I need to provide two-way communication between the launcher and each
>> instance of the viewer. (I would also love communcation between viwers,
> but
>> could just use the launcher as a relayer.) Types of information passed
> back
>> and forth would be config settings, symbol subscription requests,
> start/stop
>> requests, new business object creation requests, etc.
>>
>> Is remoting the answer to this two-way communication?
>
> Remoting could certainly be a way to do this. I would imagine your
> launcher
> would act as the remoting server and, each time it launched a viewer, it
> would pass it as a command line argument the port on which it is receiving
> remoting requests (i.e. on which you registered the TcpChannel). You'll
> need
> to do this to support terminal services since you could have multiple
> launcher processes running concurrently which can't all listen on the same
> port.
>
> The viewer would then user Activator.GetObject() to fetch some server
> object
> from the launcher and they'd communicate back and forth from there.
>
> Another, cheesier alternative which may satisfy your needs depending on
> what
> kinds of messages you have to send back and forth, is to use the standard
> in
> and out of the viewer process for messaging. This would really only be
> appropriate if all of your messages are one-way (i.e. don't require a
> response from the receiver). If you need two-way messaging (i.e. actual
> remote object calls), stick with remoting.
>
>> Would I create a singleton launcher?
>
> By singletone here I assume you mean an app for which only one instance
> can
> be running at a time. In this case, I'd say no -- there's really no need.
> If
> the launcher passed the necessary channel info to its viewers, then they
> will communicate only with it. So, multiple launcher/viewer sets could
> coexist without a problem.
>
>> Should I be looking at creating different AppDomains? I
>> have read that communications between different AppDomains in the same
>> process is faster than communications between different process. (Problem
>> with that is the single process. I guess that could crash and take
>> everything down.)
>>
>
> Using remoting between AppDomains in a single process should be faster.
> Whether that really matters or not depends on how much data you're pumping
> between the launcher and viewer. If you're just passing small bit of info
> back and forth, I wouldn't worry about this performance difference.
>
> As for process isolation, the two AppDomains should, ideally, run mostly
> independently. You could start up your viewers in AppDomains inside the
> same
> process as the Launcher and, ideally, if the viewer crashes, only that
> AppDomain is affected. However, there are two kinds of crash: one which is
> caused by an unhandled exception your code and one which is caused by .NET
> performing an illegal operation and crashing. Using AppDomains instead of
> separate processes protects you against the first type of crash but not
> the
> latter.
>
>> To take this further. What would happen if I wanted to run this
> application
>> on a terminal server? Multiple traders each with their own launcher and
> set
>> of viewers? I would guess that making the launcher a singleton would keep
>> that from happening.
>>
>
> As I mentioned above, I wouldn't worry about trying to prevent multiple
> instances of your app. I don't see that it's necessary or advantageous.
>
> Regards -
> Ken
>
>