locked
manual load balancing RRS feed

  • Question

  • I have a x-small worker role with clients connecting to an xmpp network. 

    Lets say there are 40 clients, and I want to configure 2 instances with 20 clients in each. I'd to setup in the database to which instance each client must connect.

    How should I do this... What value I have to use to tell each client to connect or not to that instance.

    Thank you.

    Sunday, December 2, 2012 12:05 PM

Answers

  • Maybe I should just create different worker roles, with only one instance but I miss the service level agreement.

    The problem with your approach is that you won't actually get the SLA you, presumably, need - the idea with the SLA is that if you deploy 2 IDENTICAL instances the platform will guarantee availability upto the SLA level. with your requirement in mind, whilst the code might be identical you're making a dangerous assumption with regards to the role of each instance, which isn't identical - one instance will serve some clients whilst the other will serve the others.

    What would you expect the platform to do should one instance fail? it would create a new instance for you, but how would you manage the affinity? half of your customers will have lost their connection.


    Yossi Dahan - http://yossidahan.wordpress.com - [To help others please mark replies as answers if you found them helpful]

    Tuesday, December 4, 2012 1:16 PM
  • I think the best way to tackle this is create a mechanism where a worker role instance would try to connect to as many (XMPP) clients as it can handle, and similarly disconnect from ones that it can't handle anymore, letting other worker instances to connect to those.

    The whole idea with azure load balancing is that each worker instance tries to do as much work as it can. Having such a design design, you can configure autoscaling to add/remove instances base on your current load. 

    So when you say you have 'X' number of worker role instances, each of size 'S' and you want each instance to handle 'N' number of XMPP clients, that is a lot of 'hardcoding'. How do you know that each worker role instance should handle 20 clients? Most likely that will either result in wasting or lacking resources. What if  'S' or 'N' or 'X' changes? Creating a design where each instances tries to do as much work as it can resolves all of these dilemas. 

    • Marked as answer by Johnson - MSFT Tuesday, December 11, 2012 11:58 AM
    Wednesday, December 5, 2012 10:54 AM

All replies

  • Hi, it is not necessary to specify which instance the client should connect. If you have more than one instance in one Web Role or Worker Role, Windows Azure will handling load balancing accross instances automatically.

    http://msdn.microsoft.com/en-us/library/windowsazure/jj151530.aspx (See The function of a load balancer probe section)

    http://www.windowsazure.com/en-us/manage/windows/common-tasks/how-to-load-balance-virtual-machines/

    http://stackoverflow.com/questions/9887926/how-to-configure-window-azure-load-balancing-between-instances

    • Proposed as answer by _mmjj_jjyy Tuesday, December 11, 2012 12:18 PM
    Monday, December 3, 2012 5:01 AM
  • Thanks, but I think I wasn't clear enought, or I'm missing the point maybe.

    My worker role hosts an array of XMPP clients. When the role starts, it gets the credentials of each user from a SQL database and connects to the XMPP server. Let's I've got 40 users, the worker role will keep 40 instances connected to the server. 

    If I rely on azure load balancing, I will have two worker role instances, both connecting  the same 40 users to an XMPP server. Am I wrong? That's what I don't want. 

    I want to be able to distribute the users to connect to different instances, manually. 

    Maybe I should just create different worker roles, with only one instance but I miss the service level agreement.

    thanks

    Tuesday, December 4, 2012 10:46 AM
  • Maybe I should just create different worker roles, with only one instance but I miss the service level agreement.

    The problem with your approach is that you won't actually get the SLA you, presumably, need - the idea with the SLA is that if you deploy 2 IDENTICAL instances the platform will guarantee availability upto the SLA level. with your requirement in mind, whilst the code might be identical you're making a dangerous assumption with regards to the role of each instance, which isn't identical - one instance will serve some clients whilst the other will serve the others.

    What would you expect the platform to do should one instance fail? it would create a new instance for you, but how would you manage the affinity? half of your customers will have lost their connection.


    Yossi Dahan - http://yossidahan.wordpress.com - [To help others please mark replies as answers if you found them helpful]

    Tuesday, December 4, 2012 1:16 PM
  • I think the best way to tackle this is create a mechanism where a worker role instance would try to connect to as many (XMPP) clients as it can handle, and similarly disconnect from ones that it can't handle anymore, letting other worker instances to connect to those.

    The whole idea with azure load balancing is that each worker instance tries to do as much work as it can. Having such a design design, you can configure autoscaling to add/remove instances base on your current load. 

    So when you say you have 'X' number of worker role instances, each of size 'S' and you want each instance to handle 'N' number of XMPP clients, that is a lot of 'hardcoding'. How do you know that each worker role instance should handle 20 clients? Most likely that will either result in wasting or lacking resources. What if  'S' or 'N' or 'X' changes? Creating a design where each instances tries to do as much work as it can resolves all of these dilemas. 

    • Marked as answer by Johnson - MSFT Tuesday, December 11, 2012 11:58 AM
    Wednesday, December 5, 2012 10:54 AM