Results 1 to 6 of 6

Thread: question about load-balancing

  1. #1
    canyoudink is offline Registered User
    Name: 陈海武
    Organization: jinan university
    Project: casual game online
    Join Date
    Jul 2005
    Posts
    10

    question about load-balancing

    for example:
    i setup 2 nodes,
    each node has a demo service (implements the icebox service).
    and then, i have 2 clients to access the demo service.

    the two clients only query the demo service's object proxy (indirect proxy) once on initialization.
    and then use the proxy repeatedly.

    i suppose, client 1 gets the endpoints of node 1, client 2 gets the node 2's.

    so, if client 1 do much more interactions than client 2,
    the node 1 work heavily than node 2.

    so what can i do to handle this situation?

    my solution is:

    client 1 & 2 hold both proxies of demo service from node 1 & 2,
    the client now has to make interactions between the 2 proxies in turn.

    but i can not get all objects by calling "findAllObjectsByType"
    it only return one object.

    so, is there any better solution?
    chen haiwu
    Firestone Software Co., Ltd
    http://www.firestone.net.cn
    casino game project

  2. #2
    benoit's Avatar
    benoit is offline ZeroC Staff
    Name: Benoit Foucher
    Organization: ZeroC, Inc.
    Project: Ice
    Join Date
    Feb 2003
    Location
    Rennes, France
    Posts
    2,196
    Hi,

    The findAllObjectsByType method should return the 2 objects provided that you have registered the two objects with IceGrid. If you used a deployment descriptor to deploy your application, can you post the descriptor here? Without more information, it's impossible to say why it only returns one object.

    Another solution would be to use a replica group with no load balancing policy for the object adapters hosting your replicated object and configure the proxy to not cache the connection (with the ice_connectionCached() method, see the Ice manual for more information). With such a setup, when your client invokes on the replicated proxy, it will retrieve the endpoints of each object adapter from the replica group and will eventually open connections and invoke on all the replicas.

    Cheers,
    Benoit.

  3. #3
    canyoudink is offline Registered User
    Name: 陈海武
    Organization: jinan university
    Project: casual game online
    Join Date
    Jul 2005
    Posts
    10

    my deploy process

    the "DemoService" is a java IceBox service .
    in order to make it easy to understand and deploy,
    i separate descriptor into serveral xml files.

    this is the "service.demo.xml"

    <icegrid>

    <replica-group id="ReplicatedDemoAdapter">
    <load-balancing type="round-robin"/>

    <object identity="demo" type="::demo:emoModel"/>
    </replica-group>

    <service-template id="DemoServiceTemplate">
    <parameter name="name"/>

    <service name="${name}" entry="demo.DemoService">
    <adapter name="${service}" register-process="true" replica-group="ReplicatedDemoAdapter"/>

    <properties>
    <property name="Identity" value="demo"/>
    </properties>
    </service>

    </service-template>

    </icegrid>

    ------------------
    and then, i install the "demo" object into 2 node2,
    below is "icebox.node1.xml"


    <icegrid>

    <node name="node1">

    <icebox id="icebox1" exe="java" activation="on-demand">
    <option>-ea</option>
    <option>IceBox.Server</option>

    <service-instance template="DemoServiceTemplate" name="DemoService1"/>
    </icebox>

    </node>

    </icegrid>

    ----------------
    now, icebox.node2.xml comes here:

    <icegrid>

    <node name="node2">

    <icebox id="icebox2" exe="java" activation="on-demand">
    <option>-ea</option>
    <option>IceBox.Server</option>

    <service-instance template="DemoServiceTemplate" name="DemoService2"/>
    </icebox>

    </node>

    </icegrid>

    ----------------------------
    at last, the application.2nodes.xml

    <icegrid>

    <application name="application.demo">

    <include file="service.demo.xml"/>

    <include file="icebox.node1.xml"/>
    <include file="icebox.node2.xml"/>

    </application>

    </icegrid>

    -------------------------

    then, run 2 icegridenode (one with icegridregistry),

    finally, load the application:
    icegridadmin --Ice.Config=config.demo -e "application add 'application.demo.xml'"
    chen haiwu
    Firestone Software Co., Ltd
    http://www.firestone.net.cn
    casino game project

  4. #4
    benoit's Avatar
    benoit is offline ZeroC Staff
    Name: Benoit Foucher
    Organization: ZeroC, Inc.
    Project: Ice
    Join Date
    Feb 2003
    Location
    Rennes, France
    Posts
    2,196
    If you use the findAllObjectsByType method and do your own load balancing, you shouldn't define the replica group in the deployment descriptor and you should register the object with the adapter instead of the replica group (that's why you only get one proxy from findAllObjectsByType right now).

    For example:

    Code:
    <service name="${name}" entry="demo.DemoService">
      <adapter name="${service}" register-process="true">
        <object identity="${server}" type="::demo::demoModel"/>
      </adapter>
      <properties>
        <property name="Identity" value="${server}"/>
      </properties>
    </service>
    The other solution I mentioned in my first post is to use the replica group and configure the proxy to not cache the connection and eventually query the locator more often, for example:

    Code:
        Ice::Object proxy = communicator->stringToProxy("demo");
        proxy = proxy->ice_connectionCached(false);
        proxy = proxy->ice_locatorCacheTimeout(5);
    Here, invocations on this proxy will be be sent to one of the replica from the replica group and the Ice runtime will get every 5 seconds a new replica from the locator (according to the load balancing policy of the replica-group, in your case round-robin).

    Cheers,
    Benoit.

  5. #5
    canyoudink is offline Registered User
    Name: 陈海武
    Organization: jinan university
    Project: casual game online
    Join Date
    Jul 2005
    Posts
    10
    thank you benoit.

    and i think, if i don't use replica-group, that's no difference between Ice.3.x and Ice.2.x.
    actually, i have done this on Ice.2.1.2, it works well.

    but the new question is:
    does the indirect proxy support fail over without replica-group?

    about the connection cached, thank you for your suggestion, i will read the manual again.
    chen haiwu
    Firestone Software Co., Ltd
    http://www.firestone.net.cn
    casino game project

  6. #6
    benoit's Avatar
    benoit is offline ZeroC Staff
    Name: Benoit Foucher
    Organization: ZeroC, Inc.
    Project: Ice
    Join Date
    Feb 2003
    Location
    Rennes, France
    Posts
    2,196
    If the objects are registered with the object adapter, not the replica group, their proxies retrieved with findAllObjectsByType will point to each individual object.

    So if the server hosting one of the object isn't available or reachable, invocations on the proxy will raise an exception, it won't automatically failover to use another replica.

    You should use a replica group if you want automatic failover.

    Cheers,
    Benoit.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. load-balancing for net-balancing
    By idealsu in forum Help Center
    Replies: 2
    Last Post: 09-24-2009, 05:21 AM
  2. Load Balancing
    By slypete in forum Help Center
    Replies: 8
    Last Post: 02-02-2009, 05:57 PM
  3. About load balancing
    By ganzuoni in forum Comments
    Replies: 3
    Last Post: 12-07-2005, 07:15 AM
  4. question about IceStorm's load balancing
    By Binary in forum Help Center
    Replies: 2
    Last Post: 09-15-2004, 09:50 PM
  5. Load Balancing
    By ganzuoni in forum Help Center
    Replies: 8
    Last Post: 06-20-2003, 06:07 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •