Archived

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

IceGrid endpoint selection problem.

Hi,
I have a problem using IceGrid, replica group and AMI invocations from the client: all the remote calls (begin_Calculate) are sent to the same endpoint while I am expecting to be randomly picked from the 4 of the virtual adapter. I have disabled the proxy connection cache and set the timeout to 0 but it behave the same. Where am I wrong?

The application deployment is:
<icegrid>
  <application name="SA">
    <server-template id="SAServer">
      <parameter name="index"/>
      <parameter name="addr"/>
      <server id="SAServer-${index}" exe="./server" activation="on-demand">
        <adapter name="SAIce" endpoints="tcp -h ${addr}" replica-group="ReplicatedAdapter" />
        <property name="Identity" value="salg" />
        <property name="Ice.MessageSizeMax" value="512000" />
        <property name="Ice.Trace.Network" value="2" />
        <property name="Ice.Trace.Protocol" value="2" />
        <property name="Ice.Trace.Locator" value="2" />
        <property name="Ice.ThreadPool.Server.Size" value="16" />
        <property name="Ice.ThreadPool.Client.Size" value="16" />
        <property name="IceMX.Metrics.Debug.GroupBy" value="id"/>
        <property name="IceMX.Metrics.Debug.Disabled" value="1"/>
        <property name="IceMX.Metrics.ByParent.GroupBy" value="parent"/>
        <property name="IceMX.Metrics.ByParent.Disabled" value="1"/>
      </server>
    </server-template>
    <node name="Node1" >
      <server-instance template="SAServer" index="1" addr="192.168.1.2" />
    </node>
    <node name="Node2" >
      <server-instance template="SAServer" index="2" addr="192.168.1.2" />
    </node>
    <node name="Node3" >
      <server-instance template="SAServer" index="3" addr="192.168.1.3" />
    </node>
    <node name="Node4" >
      <server-instance template="SAServer" index="4" addr="192.168.1.4" />
    </node>
    <replica-group id="ReplicatedAdapter" proxy-options="-e 1.1">
        <load-balancing type="random" n-replicas="4"/>
        <description>A description of this replica group.</description>
        <object identity="salg" type="::Demo::AAIce" />
    </replica-group>
  </application>
</icegrid>

The client does a loop using AMI then it stops to wait for results, like:
for(unsigned int i=0; i<nruns; i++)
{
    ....

    Ice::ObjectPrx obj = communicator()->stringToProxy("salg");
    SAIcePrx salg = SAIcePrx::checkedCast(obj);
    salg->ice_connectionCached(false);
    salg->ice_locatorCacheTimeout(0);

    ....

    salg->begin_Calculate();
    
    // wait results after 64 Calculate calls

    ....
}

Here it is a part of the client log (the only one connection estabilished with a server):
-- 02/06/14 15:37:37.355 ./clientSim: Locator: retrieved endpoints from locator, adding to locator table
   adapter = ReplicatedAdapter
   endpoints = tcp -h 192.168.1.2 -p 56069:tcp -h 192.168.1.2 -p 44414:tcp -h 192.168.1.3 -p 46487:tcp -h 192.168.1.4 -p 56807:
-- 02/06/14 15:37:37.356 ./clientSim: Network: trying to establish tcp connection to 192.168.1.3:46487
-- 02/06/14 15:37:37.356 ./clientSim: Network: tcp connection established
   local address = 192.168.1.130:48032
   remote address = 192.168.1.3:46487

Comments

  • benoit
    benoit Rennes, France
    Hi,

    Try changing your code to the following:
    SAIcePrx salg = SAIcePrx::checkedCast(obj);
    salg = salg->ice_connectionCached(false);
    salg = salg->ice_locatorCacheTimeout(0);
    

    The ice_xxx proxy methods are factory methods, they return a new proxy with the new proxy setting.

    Cheers,
    Benoit.
  • benoit wrote: »
    Hi,

    Try changing your code to the following:
    SAIcePrx salg = SAIcePrx::checkedCast(obj);
    salg = salg->ice_connectionCached(false);
    salg = salg->ice_locatorCacheTimeout(0);
    

    The ice_xxx proxy methods are factory methods, they return a new proxy with the new proxy setting.

    Cheers,
    Benoit.

    That solve the issue, thanks.

    Andrea Zoli