Go Back   ZeroC Forums > Help Center

Reply
 
LinkBack Thread Tools Rate Thread Display Modes
  #1 (permalink)  
Old 01-11-2007
jae jae is offline
Registered User
 
Name: John Eisenman
Organization: Wink Technologies
Project: Wink
 
Join Date: Oct 2006
Posts: 18
Replica Groups and conections

I've set up a replica group with a load balancing type of Random. I have written a couple of test clients (in Python and Java) that connect to this group. The clients themselves are implemented as Ice Applications.

I can confirm that when I run a test client, it randomly selects one of the server endpoints for the connection.

I have also added a loop to the test code where it attempts to select a new proxy each time through the loop. I find that within the test client, it always connects to the same server. Is this expected? My expectation was that I could connect to a different server for load balancing reasons.

I have a replica group called, "CanonicServerGroup".

My python test code looks like this:

Code:
for r in range(repeat):
    bProxy = self.communicator().stringToProxy("Boost@CanonicServerGroup")
    boost = UrlIce.BoostPrx.checkedCast(bProxy)
    .... more code to communicate with boost ....
Section 36.9 of the Ice manual states:

Quote:
IceGrid’s load balancing capability assists the client in selecting an initial endpoint for a connection. As discussed in Section 30.17.2, once a client has established a connection, all subsequent requests on the proxy that initiated the connection are sent to the same server without further consideration for load balancing.
In this case, has the connection already been established? What is the correct way to obtain a connection to a newly selected endpoint?
__________________
* John Eisenman
* Wink Technologies (wink.com)
Reply With Quote
  #2 (permalink)  
Old 01-11-2007
Greenhippo Greenhippo is offline
Registered User
 
Name: Alex
Organization: University of Auckland
Project: Intelligent Middleware
 
Join Date: Nov 2006
Posts: 32
Ice caches its results from registry lookups, so everytime you think you are getting a new object its just getting its cached copy

try setting this in your config file
Code:
Ice.Default.LocatorCacheTimeout=0
__________________
Alex Davies
The University of Auckland
Reply With Quote
  #3 (permalink)  
Old 01-11-2007
jae jae is offline
Registered User
 
Name: John Eisenman
Organization: Wink Technologies
Project: Wink
 
Join Date: Oct 2006
Posts: 18
Thanks. I set Ice.Default.LocatorCacheTimeout=0 for my client and now see all servers being used at random. In practice, I assume that we might set this to some number of seconds. Is this the proper way to achieve the result that I want?
__________________
* John Eisenman
* Wink Technologies (wink.com)
Reply With Quote
  #4 (permalink)  
Old 01-12-2007
benoit's Avatar
benoit benoit is online now
ZeroC Staff
 
Name: Benoit Foucher
Organization: ZeroC, Inc.
Project: Ice
 
Join Date: Feb 2003
Location: Rennes, France
Posts: 1,545
Hi,

Yes, if you want the load balancing to be taken care of by IceGrid, you need to set a low locator cache timeout to ensure that the client will regularily contact the IceGrid locator to retrieve new endpoints for the proxy.

Another possibility is to configure the replica group to return multiple endpoints and set a higher locator cache timeout to avoid contacting the IceGrid locator too often. The load balancing will then be done locally by the Ice runtime by selecting at random one of the endpoints associated to the proxy.

Note that you also need to configure the proxy with ice_connectionCached(false) to ensure that connections aren't cached with the proxy (see the Ice manual for more information). You can also configure the locator cache timeout on a per proxy basis.

So I would do the following:

Code:
    const int timeout = 
    bProxy = self.communicator().stringToProxy("Boost@CanonicServerGroup")
    bProxy = bProxy.ice_connectionCached(false);
    bProxy = bProxy.ice_locatorCacheTimeout(60); // 60 seconds
    boost = UrlIce.BoostPrx.checkedCast(bProxy)
for r in range(repeat):
    .... more code to communicate with boost ....
Cheers,
Benoit.
Reply With Quote
  #5 (permalink)  
Old 04-02-2007
jae jae is offline
Registered User
 
Name: John Eisenman
Organization: Wink Technologies
Project: Wink
 
Join Date: Oct 2006
Posts: 18
"Broadcast" to all members of a replica group?

Thanks for the above information; it was just what I needed.

I have related question. I have some functions that I'd like to call for all members of a replica group. As you mention, IceGrid can return all members of a replica group; how can I gain access to this information and call the same function on each?
__________________
* John Eisenman
* Wink Technologies (wink.com)
Reply With Quote
  #6 (permalink)  
Old 04-02-2007
benoit's Avatar
benoit benoit is online now
ZeroC Staff
 
Name: Benoit Foucher
Organization: ZeroC, Inc.
Project: Ice
 
Join Date: Feb 2003
Location: Rennes, France
Posts: 1,545
Hi,

You can retrieve the proxy of each individual replica with the IceGrid::Query::findAllReplicas method (introduced in Ice 3.2). Let us know if you need more information!

Cheers,
Benoit.
Reply With Quote
  #7 (permalink)  
Old 04-02-2007
jae jae is offline
Registered User
 
Name: John Eisenman
Organization: Wink Technologies
Project: Wink
 
Join Date: Oct 2006
Posts: 18
Sounds like another reason to move to 3.2.

My project is currently running 3.1 (and won't be upgrading right away). Is there also a solution under 3.1?

-John
__________________
* John Eisenman
* Wink Technologies (wink.com)
Reply With Quote
  #8 (permalink)  
Old 04-02-2007
benoit's Avatar
benoit benoit is online now
ZeroC Staff
 
Name: Benoit Foucher
Organization: ZeroC, Inc.
Project: Ice
 
Join Date: Feb 2003
Location: Rennes, France
Posts: 1,545
You could register a well-known object with the adapter descriptor. This well-known object would be registered with a given type which would be used to retrieve the proxies of each object with the IceGrid::Query::findAllObjectsByType method.

Cheers,
Benoit.
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
IceGrid Replica Names zhi Help Center 1 12-26-2006 04:31 AM
maintaining replica state Greenhippo Help Center 2 11-21-2006 04:25 AM
Ice 3.1.1 core dump while invoke on replica sinofool Help Center 8 11-06-2006 10:32 AM
Patch of IceGrid replica-group type None sinofool Help Center 2 10-31-2006 06:49 AM


All times are GMT -4. The time now is 01:14 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0
(c) 2008 ZeroC, Inc.