Home Help Center

IceGrid and load balancing

MatthieuMatthieu Member Mat ReiOrganization: 4sxs ConsultingProject: communication
I try to run an IceGrid application with load balancing...

That's why I did two servers (in java) which have a single object (affpoint).

The two servers are located in two differents directory, are called both "Serverpoint.class"; I create the directory db, db/Registry, db/Node1, db/node3 for icegrid service.

I put in my XML file :
- a replica-group
<replica-group id="Raffpoint">
<load-balancing type="adaptive" load-sample="5" n-replicas="2"/>
<object identity="affpoint" type="::Demo::Caracteristique"/>
</replica-group>


- a server template
<server-template id="affpointTemplate">
<parameter name="index"/>
<parameter name="exepath" default="java"/>
<server id="AffpointServer${index}" exe="${exepath}" activation="on-demand">
<option>Serverpoint</option>
<property name="Ice.MessageSizeMax" value="1000000000"/>
<adapter name="Aaffpoint" endpoints="tcp" register-process="true" replica-group="Raffpoint"/>
</server>
</server-template>


- two nodes with the two server-instances
<node name="Node1">
<server-instance template="affpointTemplate" index="2"/>
</node>

<node name="node3">
<server-instance template="affpointTemplate" index="1"/>
</node>


I associate the XML file to the IceGrid service with :
icegridadmin --Ice.Config=IceGrid\config.grid -e "application add ..\application_load_bal.xml"

I run the two servers with :
icegridnode --Ice.Config=config.host1
icegridnode --Ice.Config=config.host2



When I try to use the object affpoint with a client, the server on node3 answer and execute the request. If I shut down this server, the object is no more available, even if the server on node1 is running...

Other questions : are the server-template absolutely necessary in order to do load-balancing ?

Thank you for your help !
Matthieu

Comments

  • benoitbenoit Rennes, FranceAdministrators, ZeroC Staff Benoit FoucherOrganization: ZeroC, Inc.Project: Ice ZeroC Staff
    Hi Matthieu,

    Are you sure the node name from the XML descriptor matches the one in the icegridnode configuration file? For instance, do you use "node1" or "Node1" (as specified in the XML) in the configuration file of the IceGrid node?

    If you don't want to use server templates you can just use server descriptors in the XML deployment descriptors (<server> XML element). Or are you asking if it's possible to use replica groups without XML descriptors? That's also possible when using dynamic registration but it's more limited (only random load balancing is possible). See Michi's article for more information on dynamic registration here: Teach Yourself IceGrid in 10 Minutes or here in the Ice manual.

    Cheers,
    Benoit.
  • MatthieuMatthieu Member Mat ReiOrganization: 4sxs ConsultingProject: communication
    Right !!
    It was a problem with the node name... Thank you, it works now !

    Thank you for the articles !

    About my question : it is possible to do load-balancing beetween objects without define them in <server-instance> configured by <serveur-template> ?

    Cheers,
    Matthieu
  • spsonispsoni Member Sury P SoniOrganization: Next DigitalProject: Unified Messaging Plattform for Inhouse Products ✭✭
    benoit wrote: »
    Are you asking if it's possible to use replica groups without XML descriptors? That's also possible when using dynamic registration but it's more limited (only random load balancing is possible). See Michi's article for more information on dynamic registration here: Teach Yourself IceGrid in 10 Minutes or here in the Ice manual.

    Hi,

    Can anyone provide me some basic but full working example for dynamic registration? Links above, only refer to use DynamicRegistration, but not full example code.

    As, I need to create/delete many replica groups and adapters on the fly, which is not possible without using dynamic registration and I am happy with random load balancing.

    I am confused due to following comment on other thread as well.
    benoit wrote: »
    Also, note that you can't mix dynamically registered adapters with adapters deployed with a deployment descriptor for a replica group.

    I am using python binding for Ice-3.3.1 on FreeBSD 7.1.

    Regards,

    Surya
  • spsonispsoni Member Sury P SoniOrganization: Next DigitalProject: Unified Messaging Plattform for Inhouse Products ✭✭
    Hi,

    I am able to create replica group dynamically as follows:
    replicaGroups = []
    replicaGroups.append(IceGrid.ReplicaGroupDescriptor(id='ReplicatedMasterAdapter-'+queueName, loadBalancing=IceGrid.RoundRobinLoadBalancingPolicy(nReplicas='0')))
    appDesc = IceGrid.ApplicationUpdateDescriptor(name='DBNodeApp', replicaGroups=replicaGroups)
    self.admin.updateApplication(appDesc)
    

    But now I am confused, how to dynamically create adapter as we can do through application desription xml file as follows.
    <icegrid>
      <application name="DBNodeApp">
          <server
    			id = "DBNode"
    			exe = "/usr/local/bin/python"
    			activation = "on-demand" >
            <option>dbQueueNode.py</option>
            [B]<adapter
            	name			= "DBNodeAdapter"
            	replica-group		= "ReplicatedDBNodeAdapter">
            </adapter>[/B]
    ....
    ....
         </server>
      </application>
    </icegrid>
    

    I need to create new adapter and associate it with newly created replica group.

    Cheers.

    Surya
  • benoitbenoit Rennes, FranceAdministrators, ZeroC Staff Benoit FoucherOrganization: ZeroC, Inc.Project: Ice ZeroC Staff
    Hi Surya,

    Note that you're not really using dynamic registration here.

    The IceGrid dynamic registration feature doesn't involve any deployment descriptors. You just configure the registry to allow dynamic registration with IceGrid.Registry.DynamicRegistration=1 and you start a server which has some object adapters with the AdapterId or ReplicaGroupId properties set. Upon startup, the server will register its OA endpoints with these IDs and the registry will add corresponding entries in its tables automatically: no previous registration is required through the deployment mechanism for this to work.

    Michi's Teach Yourself IceGrid in 10 Minutes article provides more information and examples about IceGrid dynamic registration.

    Now, if you want your servers to be managed by an IceGrid node, you can't use dynamic registration (as described above) and you need to deploy your servers through the deployment mechanism (either using XML deployment descriptors, registering the server through the IceGrid::Admin interface, using the GUI, etc). Object adapters are described with the server deployment descriptor so to specify an object adapter for a server you need to modify its server deployment descriptor. In order to do this, you need to create an application update descriptor which itself will contain a server update descriptor containing the description of the new object adapter.

    I recommend taking a look at cpp/test/IceGrid/update/AllTests.cpp for examples on how to update existing deployed applications. Let me know if you need more information on this.

    Cheers,
    Benoit.
Sign In or Register to comment.