EndpointSelectionType.Random

rpynorrpynor Member Rohan PynorOrganization: Barclays CapitalProject: Financial software
Hi there,

I'm trying to get a load balanced solution implemented, where the client will randomly pick a server to connect to and after scanning the forums, came up with this:

var ic = Ice.Util.initialize();
Ice.ObjectPrx baseA = ic.stringToProxy("UserServices:tcp -h localhost -p 20001:tcp -h localhost -p 20002:tcp -h localhost -p 30002");
baseA = baseA.ice_endpointSelection(Ice.EndpointSelectionType.Random);

var x = UserServicesIPrxHelper.uncheckedCast(baseA);
x.TestConnect();
x.TestConnect();
x.TestConnect();
x.TestConnect();

in this case, if i started up two servers, at 20002 and 30002, i would expect at least one of the TestConnects() to execute on 30002 - instead, it is always run on 20001. Am i just misunderstanding how the Random should work, or is it some other problem ?



ice is 3.3.1.0
os is windows xp
compiler is visual studio 2008 (c#)

thanks,

Rohan

Comments

  • matthewmatthew NL, CanadaMember Matthew NewhookOrganization: ZeroC, Inc.Project: Internet Communications Engine ✭✭✭
    The problem is that your client is reusing a cached connection for each request. For more details regarding how connection management works with Ice you should read my article "Connection Management in Ice" in http://www.zeroc.com/newsletter/issue24.pdf.
Sign In or Register to comment.