2

I think of using Wasabi block for auto-scaling my Azure application. Looks like the rules have to be hardcoded in an XML file. This bothers me, because the rules I want for my application require a rather complex metric that I will have to compute inside my code.

Just as an insane example, suppose my application generates a stream of random numbers - zeroes and ones - and each instance computes the number of "ones" in row and number of "zeroes" in row. I want to scale up when any instance encounters ten or more successive "ones" and scale down when any instance encounters ten or more successive "zeroes".

I can detect such situations in my code no problem, but how do I make Wasabi react to them and scale the application?

sharptooth
  • 167,383
  • 100
  • 513
  • 979

1 Answers1

2

To achieve this you need to implement a CustomOperand and an associated Custom DataCollector. http://msdn.microsoft.com/en-us/library/hh680912(v=pandp.50).aspx

There is an example of this in the TailSpin sample application. I would start by looking at the ActiveSurveysDataPointsCollector class and working your way back up from there (the custom operand consumes an IDataPointCollector instance and the operand is then referenced, like all other operands, from the rules XML.

You'll implement the method public IEnumerable Collect(DateTimeOffset collectionTime) and this is where you'll want to look at your stream of bits or some other flag which is set by your stream of bits creator. There is no way to signal into Wasabi in a synchronous fashion; you will always be having the Collect method execute and retrieve that information from your app (or calculate it then and there).

Chris J.T. Auld
  • 986
  • 4
  • 8
  • 1
    Good answer, Chris. Tailspin sample app is one way to learn how to define your custom operands. Additionally, you may want to check out the hands-on lab #7 which walks you through the process of doing the same - http://www.microsoft.com/download/en/details.aspx?id=28785 – Grigori Melnik Mar 23 '12 at 21:52
  • This is an old question, but I was wondering if Grigori would comment on it. In my reactive rule, I want the action to scale up by "x", rather than a hard-coded number in the XML file. My reactive rule needs to compute the amount of instances the Worker Role needs to scale up by and it then needs to pass this to the block. How can I achieve this? – Taha Ahmad Feb 19 '16 at 07:51