Archived

This forum has been archived. Please start a new discussion on GitHub.

do i need the second communicator ?

Hi,

My application has to work as a server and as a client for another server
at the same time. Although these parts (server and client) are rather
independent there were some arguments to implement them
in the same process.
The first (server) part is Ice::Service and the second (client)
part is Ice::Thread. The structure of the second part is simple:

for(;;) {
sleep(some_time);
results = do_smth();
ice_objectPrx->report(results);
}


Can I use the communicator from the first part to construct 'ice_objectPrx' ?
Or I need to create new one (as I did) ?
If both possibilities are available, which are the better ?
Could you give me an advice on which properties of my application should
I pay attention to make the correct choice between these two alternatives ?

--
Cheers, Nikolai

Comments

  • marc
    marc Florida
    You can both use the same or different communicators. The main differences are:
    • If you use only one communicator, you can only have one configuration (i.e., set of properties).
    • If you use one communicator, collocated calls are optimized. With two communicators, calls from a proxy of one communicator to an Ice object implemented with the other will go over the wire, without any collocation optimization.
    • Two communicators consume more resources, as they are completely independent. For example, you have two sets of thread pools.
    • Two communicators completely separate two logical Ice clients or servers in the same process, meaning that if for example one of the two runs out of threads in one of the thread pools, it doesn't affect the other.

    If you use a separate communicator, think of it as a separate logical process.