Archived

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

Load balancing with dynamic registration

Hello,

I want to implement dynamic registration without xml deployment descriptor.
Load Balancing chapter in the documentation contains information how to configure it in deployment descriptor, but no information how to use load balancing with dynamic registration.
I don't see any properties to configure it in Property Reference chapter.
It's only possible to specify ReplicaGroupId property in config.

Is there a way to configure load balancing for dynamic registration?

Thanks

Comments

  • benoit
    benoit Rennes, France
    Hi Sergey,

    This is currently undocumented, we will fix the manual to mention it.

    For dynamically registered replica groups, IceGrid looks up for replica group filters identified with the empty string. Your registry plugin should therefore register the filters using an empty string identifier.

    Cheers,
    Benoit.
  • Hi Benoit,

    What about well-known objects.

    In case of static deployment xmd descriptor contains:
    <replica-group id="ReplicaId">
    	<load-balancing type="random" n-replicas="0" />
    	<object identity="Identity" type="type" />
    </replica-group>
    

    Can I define well-known objects in the ice configuration in case of dynamic deployment?
    Same way as adaptors, identities, etc.
    Manual describes how to do it via icegridadmin or programmatically only.

    Thanks
  • benoit
    benoit Rennes, France
    Hi,

    It's currently not possible to register well-known objects through other means than those described in the manual (XML descriptors, programmatically or with the administrative tools).

    Cheers,
    Benoit.
  • raycray
    edited June 2017

    Hi Benoit, Sergey,

    I tried to follow your suggestion for dynamic register adapters with load-balancing features. I have added the custom ReplicaGroupFilter in icegridregistry, but when i tried to query all adapters by Query::findAllReplicas, i couldn't get the adapters at all. So what is the proper way to query the

    auto replicaObj = slice::CalcNodePrx::uncheckedCast(comm->stringToProxy("CalcNodeAdapters"));````
    IceGrid::QueryPrx query = IceGrid::QueryPrx::checkedCast(comm->stringToProxy(comm->getDefaultLocator()->ice_getIdentity().category + "/Query"));
    auto adapters = query->findAllReplicas(replicaObj);
    

    adapters is always empty. Please kindly advice how to query the dynamic adapters in replica group

    ICE version 3.6.3

  • It seems my proxy name was incorrect. Once i changed from replicaId to objectId@replicaId, the findAllReplica query works perfectly.
    Would it be the correct way to query dynamic register adapters?

  • benoit
    benoit Rennes, France

    Hi,

    Are you trying to get the list of dynamically registered adapters from the replica group filter implementation?

    If yes, it's better to use the registry plugin facade object. It provides the getAdapterInfo method which should return information on the object adapter members of the replica group.

    See https://doc.zeroc.com/display/Ice36/Load+Balancing#LoadBalancing-TheRegistryPlug-inFacadeObject for more information on this.

    Cheers
    Benoit

  • Hi Benoit,

    Thank you for your reply.
    my ultimate goal is have simple load balancing (likely round-robin) by leveraging replicaGroup. I read through the ice doc and understand the ICE admin/deployment could achieve, but if possible i would like to use dynamic registered adapters.

    I did an experiment that creating the following dynamic object adapters:
    1. adapterID=CalcNode1, objectId=CalcNode, replicaGroupid=CalcNodeAdapters
    2. adapterID=CalcNode2, objectId=CalcNode, replicaGroupid=CalcNodeAdapters
    3. adapterID=CalcNodeTest1, replicaGroupid=CalcNodeAdaptersTest

    then i perform 2 queries
    auto adapters = query->findAllReplicas("CalcNode@CalcNodeAdapters"); // gets CalcNode1 and CalcNode2
    auto adapters = query->findAllReplicas("CalcNode@CalcNodeAdaptersTest"); // gets CalcNodeTest1

    without adding any IceGrid::ReplicaGroupFilter, the icegridregistry already give me the results i desired, So my questions are:
    A. Do i really need to implement and load IceGrid::ReplicaGroupFilter to icegridregistry and use registry plugin facade in order to "filter" adapters for particular replicate group?
    B. Am I do anything wrong at the client side to use Query interface?

    As this feature is not very well documented in the easy to read ICE doc, so it would be nice if you could give me some lights, many thx.

  • benoit
    benoit Rennes, France

    Hi Ray,

    You can use the IceGrid::Query::findAllReplicas invocation to find all the replicas and implement the load balancing logic in your client or to implement a load balancing service used by your clients. Using a custom replica group filter is another option. It's a design decision you need to make here.

    Implementing the logic directly in the client is probably simpler if you have a single client using the multiple replicas. If you deploy multiple clients however, it's simpler to have the load balancing logic in a centralized service. This centralized service can either be a service that you implement using findAllReplicas or it could be a custom replica group filter that would run with the IceGrid registry process.

    Cheers,
    Benoit.

  • It is very clear now, thank you very much for your reply!