Archived

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

Icegrid checkcast function blocked sometime

i test the icegrid demo in official ice package.

the client code is :
String locator = "DemoIceGrid/Locator:default -p 4061 -h 192.168.28.50";  
        Ice.Properties props = Ice.Util.createProperties();
        props.setProperty("Ice.Default.Locator", locator);
        Ice.InitializationData id = new Ice.InitializationData();
        id.properties = props;
        Communicator comm = Ice.Util.initialize(id);
        long startTime = System.currentTimeMillis();
        IceGrid.QueryPrx query = IceGrid.QueryPrxHelper.checkedCast(comm.stringToProxy("DemoIceGrid/Query"));
        ObjectPrx objPrx = query.findObjectByType("::Demo::Hello");
        HelloPrx hello = HelloPrxHelper.checkedCast(objPrx);
        hello.sayHello();
        long endTime = System.currentTimeMillis();
        if((endTime-startTime) > 5000)
       {
            System.out.println("consume Time:" + (endTime-startTime)/1000 +" s, ");
        }

sometime, the codes will execute long time about 20s, but sometime only it will execute in a very short time.

using jprofile tool, I find the time-consuming code is :
=================
HelloPrx hello = HelloPrxHelper.checkedCast(objPrx);

=====================
the icegrid node config is:
<icegrid>
  <application name="Simple">
    <server-template id="SimpleServer">
      <parameter name="index"/>
      <server id="SimpleServer-${index}" exe="java" activation="on-demand">
        <option>Server</option>
        <adapter name="Hello" endpoints="tcp">
          <object identity="hello-${index}" type="::Demo::Hello" property="Identity"/>
        </adapter>
      </server>
    </server-template>
    <node name="node1">
      <server-instance template="SimpleServer" index="1"/>
    </node>
  </application>
</icegrid>

==========================
Ice.Default.Locator=DemoIceGrid/Locator:default -p 4061 -h 192.168.28.50
IceGrid.Registry.Client.Endpoints=default -p 4061
IceGrid.Registry.Server.Endpoints=default
IceGrid.Registry.Internal.Endpoints=default
IceGrid.Registry.Data=db/registry
IceGrid.Registry.PermissionsVerifier=DemoIceGrid/NullPermissionsVerifier
IceGrid.Registry.AdminPermissionsVerifier=DemoIceGrid/NullPermissionsVerifier
IceGrid.Registry.SSLPermissionsVerifier=DemoIceGrid/NullSSLPermissionsVerifier
IceGrid.Registry.AdminSSLPermissionsVerifier=DemoIceGrid/NullSSLPermissionsVerifier
IceGrid.Node.Name=node1
IceGrid.Node.Endpoints=default
IceGrid.Node.Data=db/node
IceGrid.Node.CollocateRegistry=1
IceGrid.Node.Trace.Activator=1
IceGridAdmin.Username=foo
IceGridAdmin.Password=bar

I want to know what's the reason for this statution. how to solve it ?
Thanks very much

Comments

  • benoit
    benoit Rennes, France
    Hi,

    Could it be that the server activation is taking a long time when it takes 20s? Which OS and Ice version do you use?

    To track down where this is coming from, you could add some tracing to the client by setting the following Ice properties:
    Ice.Trace.Network=2
    Ice.Trace.Protocol=2
    Ice.Trace.Locator=2
    

    You could also set IceGrid.Node.Trace.Activator=2 in the IceGrid node configuration file to see if it's the server activation which is taking a long time.

    Cheers,
    Benoit.
  • hi, benoit.

    I have find the problem.

    The ice grid server os is redhat 6.3. the server has a virtual network interface(virbr0), the interface ip address is 192.168.122.1, almost every redhat os server will have virbr0.

    the application config file define the endpoints "tcp".
    so the adapter published endpoint will be "tcp -h 192.168.122.1: tcp -h 192.168.28.50"(eth0 ip is 192.168.28.50).

    but in our local network, there are many other server which virbr0 ip addresses are all 192.168.122.1.

    when i set the adapter endpoints "tcp" to "tcp -h 192.168.28.50" or set virbr0 address is 192.168.122.2, the problem will never reproduce.

    but i don't want modify the adapter config. the indirect binding will better in a lager cluster.

    so, I want to know whether or not there is any solution using indect binding?
    in my opinion, ice default published endpoints should not contain virtual network interface(virbr0).
  • benoit
    benoit Rennes, France
    Hi,

    Ice doesn't filter out virtual interfaces. You will need to either set the object adapter endpoints or published endpoints if you don't want the IP of the virtual interface to be included. If you don't want to include this property in the server configuration for practical reasons, you could set this property in the node configuration file using IceGrid.Node.PropertiesOverrides="--MyAdapter.Endpoints=tcp -h 192.168.28.50" for example. All the servers started by the node will have this property set.

    Cheers,
    Benoit.