Results 1 to 2 of 2

Thread: Cannot get IceGrid round robin to work

  1. #1
    Ian James is offline Registered User
    Name: Ian James
    Organization: Deutsche Bank
    Project: Equities IT
    Join Date
    Jun 2007
    Posts
    4

    Cannot get IceGrid round robin to work

    Hi, Im having trouble getting the load balancing policy on my replica groups for my grid application to work as i think it should. What i want is that every other call i make on an "A" replica will be to SC_A_1, with the other going to SC_A_2 on the other node.

    Here is a sample of the grid file im using for my app - we run 2 "A" servers and 2 "B"s. Ive removed the spurious java options/parameters for clarity.

    Code:
    <icegrid>
            <application name="MyProcessApplication">
    	
     <replica-group id="A">
       <load-balancing type="round-robin" />
        <object identity="A" type="com::wind::MyProcess"/>    
     </replica-group>
     
      <replica-group id="B">
       <load-balancing type="round-robin"/>
        <object identity="B" type="com::wind::MyProcess"/>    
     </replica-group>
     
     <server-template id="MyProcess">
                <server id="MyProcess-${index}-DEV" activation="manual" exe="/apps/jdk1.6.0_02/bin/java" pwd="${home}">
                <option>-server</option>
                <option>MyProcess</option>
    				<adapter name="MyProcessAdapter"
                            replica-group="${group}"
                        register-process="true"
                        endpoints="tcp -h ${server.ip.address}">
                    </adapter>
    				<property name="Ice.MessageSizeMax" value="20000"/>
                </server>
            </server-template>
    
            <node name="PrimaryNode">
            	<server-instance template="MyProcess" index="1" group="A" server.ip.address="12.143.29.120" name="SC_A_1"/>
            	<server-instance template="MyProcess" index="3" group="B" server.ip.address="12.143.29.120" name="SC_B_1" />            
            </node>
            
            <node name="SecondaryNode">
            	<server-instance template="MyProcess" index="2" group="A" server.ip.address="12.143.29.120" name="SC_A_2" />
            	<server-instance template="MyProcess" index="4" group="B" server.ip.address="12.143.29.120" name="SC_B_2" />
            </node>
    
            </application>
    </icegrid>

    My client code is
    <CODE>
    ObjectPrx prx = communicator.stringToProxy("A");
    this.proxy = MyProcessPrxHelper.uncheckedCast(prx);
    for (int i = 0; i < LOOPS; i++) {
    logger.info("i: " + i + + " - " + proxy.getName());
    }
    </CODE>

    Im expecting each call on the proxy to round robin e.g SC_A_1, SC_A_2, SC_A_1 etc. But i find it always invokes on SC_A_1 or SC_A_2 but every call then invokes on the same server.

    Any ideas/advice?
    Ian James
    Equities IT, Deutsche Bank
    London

  2. #2
    bernard's Avatar
    bernard is offline ZeroC Staff
    Name: Bernard Normier
    Organization: ZeroC, Inc.
    Project: Ice
    Join Date
    Feb 2003
    Location
    Palm Beach Gardens, FL
    Posts
    1,294
    Hi Ian,

    What you're seeing is the expected behavior .

    There are two default behaviors at play here:
    - by default, Ice (your client-side runtime) caches connections and prefers endpoints with an established connections to endpoints without.

    Your first call creates a connection to SC_A_1, and since this connection is established, subsequent calls to the "same" replicated object will reuse this connection.

    This behavior (and how to change it) is described in details in the "Connection Management in Ice" article in issue 24 of our newsletter.

    - by default, Ice (still the client-side runtime) also caches indirect-proxy resolution. When you resolve a well-known proxy, adapter id or replica group id, Ice keeps the result in its "locator cache".

    With your current replica-group definition, n-replicas is 1 (the default), so each resolution returns the endpoint(s) for a single object adapter. That's probably what you want. However, you don't want to use the same object adapter over and over--you want your client runtime to resolve the well-known proxy for each call, i.e. ask IceGrid for the next object-adapter in its round-robin list. You can do so by disabling the locator cache in your client:

    Ice.Default.LocatorCacheTimeout=0

    See http://www.zeroc.com/doc/Ice-3.3.0b/...ver.29.17.html
    and http://www.zeroc.com/doc/Ice-3.3.0b/...pRef.46.8.html for further details.

    Best regards,
    Bernard
    Bernard Normier
    ZeroC, Inc.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Ice Client Connection , how to save on round trips ?
    By Faiz.Usmani in forum Help Center
    Replies: 7
    Last Post: 06-23-2008, 11:00 AM
  2. Bug in round-robin load balancing
    By javier.pb in forum Bug Reports
    Replies: 2
    Last Post: 11-28-2007, 04:46 AM
  3. How to reduce round trip delay?
    By andreynech in forum Help Center
    Replies: 6
    Last Post: 10-07-2007, 10:16 AM
  4. Replies: 5
    Last Post: 12-04-2006, 12:41 PM
  5. Round-Trip Latency
    By chuckmo in forum Comments
    Replies: 5
    Last Post: 02-19-2006, 08:29 AM

Posting Permissions

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