質問

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?

役に立ちましたか?

解決

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).

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top