Results 1 to 9 of 9

Thread: Load Balancing per request

  1. #1
    chamate01 is offline Registered User
    Name: Mark Channing
    Organization: Barclays
    Project: Event Framework
    Join Date
    Oct 2008
    Posts
    9

    Question Load Balancing per request

    Is there anyway to do random server usage per request using similar semantics as the random server selection when establising the communication channel.

    It would seem pointless to timeout the connection to acheive load balancing.


    Actually I found this .....

    -> Ice::Object proxy = communicator->stringToProxy("demo");
    proxy = proxy->ice_connectionCached(false);
    proxy = proxy->ice_locatorCacheTimeout(5);

    would this be expensive, if used alot.
    Last edited by chamate01; 06-26-2009 at 05:26 AM. Reason: Reviewed other posts.

  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,

    It's slightly more expensive since for each request the proxy will need to lookup a suitable (existing) outgoing connection (because the connection is not cached anymore with the proxy). It will also cause locator lookups every 5s (you might want to increase this to reduce the number of lookups...).

    I don't think it will really matter however for most applications... so unless your application is really performance critical (in which case I would recommend to benchmark this), it should be fine.

    I recommend taking a look at Matthew's article about connection management to get a better understanding on what's really happening under the hood when these settings are set, see Issue #24 of the Ice Connections newsletter.

    Cheers,
    Benoit.

  3. #3
    chamate01 is offline Registered User
    Name: Mark Channing
    Organization: Barclays
    Project: Event Framework
    Join Date
    Oct 2008
    Posts
    9
    Thanks. I could use this as a temporary solution however I have a feeling that using IceGrid would be a better solution.

    What I have is 300K events waiting to be processed and the configuration will be 10 servers each with 8 identical servers on. This is what I want to call in a load balanced manner. My current version does not use IceGrid so I just wanted to get something quick done.

    However now that I have explained what I am doing, does IceGrid in your opinion seem the correct approach, and IceGrid supports load balancing.

  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
    Hi,

    Actually, IceGrid won't bring you a lot more with respect to load balancing, in terms of efficiency at least. The most efficient way to do load balancing is on the client side like you do right now: the Ice runtime selects a random endpoint within the set of proxy endpoints.

    IceGrid will provide you a lot more flexibility however for the deployment: you can easily add/remove servers without having to update/restart the clients (the clients will retrieve automatically the new set of endpoints from the locator). It will also provide you more load balancing options: round-robin and adaptive; but these options will have a higher cost as the Ice client runtime might has to consult the IceGrid registry to figure out the endpoint to use for a request.

    Cheers,
    Benoit.

  5. #5
    nachiket is offline Registered User
    Name: Nachiket Shah
    Organization: Barclays Capital
    Project: FLOW
    Join Date
    Oct 2008
    Posts
    3

    Help with load balancing

    Hi Benoit

    I am a developer in chamate01’s team.

    I am unable to achieve Load Balancing using replication (as discussed in this post). I have even explicitly closed proxy’s connection; however I am always connecting to the same servant.

    I am attaching a demo application with this post.

    Please help me find what is missed here.

    Cheers
    Nachi
    Attached Files Attached Files

  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
    Hi Nachi,

    I'm afraid you found a bug . The random endpoint selection doesn't work for proxies with only 2 endpoints. It will work if you add an additional endpoint however, try for example with the proxy: Hello -t:tcp -h localhost -p 16000:tcp -h localhost -p 16000:tcp -h localhost -p 16001

    I will prepare and post a patch for this issue later today. Thanks for reporting this bug.

    Btw, you only need to set ice_connectionCached(false) in your test case for the load balancing to work (other settings are not useful or are already the defaults). You also don't need to close the connection explicitly: closing and re-opening the connection is expensive so it's best to keep the connections open.

    Cheers,
    Benoit.

  7. #7
    nachiket is offline Registered User
    Name: Nachiket Shah
    Organization: Barclays Capital
    Project: FLOW
    Join Date
    Oct 2008
    Posts
    3
    Hi Benoit,

    We are using a patched ice dll. Actually you are the one who provided us the patch earlier. I will send you an email with existing patch, so you can patch it further.


    And yes you are correct, I had added the same endpoints two times and the load balancing works fine!! Thanks for your help.


    ObjectPrx objProxy = Communicator.stringToProxy("Hello -t:tcp -h localhost -p 16000:tcp -h localhost -p 16001:tcp -h localhost -p 16000:tcp -h localhost -p 16001");

    Regards
    Nachi

  8. #8
    chamate01 is offline Registered User
    Name: Mark Channing
    Organization: Barclays
    Project: Event Framework
    Join Date
    Oct 2008
    Posts
    9

    Talking Michi not fixed this already

    Hi Benoit,

    Should this not have been fixed or is it a different issue than the one that Michi mentions in this post, Load balancing and fault tolerance.

    Either way look forward to your patch.

  9. #9
    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 Mark,

    You're right, this bug has been reported already but unfortunately we forgot to fix our mainline Anyway, it is fixed now and it will be included in the upcoming Ice version. I've posted the patch here. Thanks for bringing this to our attention!

    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. IceGrid and load balancing
    By Matthieu in forum Help Center
    Replies: 5
    Last Post: 06-12-2009, 02:59 AM
  3. Load Balancing
    By slypete in forum Help Center
    Replies: 8
    Last Post: 02-02-2009, 05:57 PM
  4. About load balancing
    By ganzuoni in forum Comments
    Replies: 3
    Last Post: 12-07-2005, 07:15 AM
  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
  •