Skip to content

ThrottlingBehaviour

ikopylov edited this page Dec 26, 2014 · 1 revision

Qoollo ThrottlingBehaviour

ThrottlingBehaviour is a primitive responsible for regulating the rate at which application processing is conducted.

ThrottleBehavior sample:

ThrottleBehavior throttler = new ThrottleBehavior(maxRequestPerSecond: 100);

if (throttler.AddHit())
{
    //do work
    Console.WriteLine("hit ok");
}

CPUThrottleBehavior - ThrottleBehavior that call Sleep when execution quota is exceeded.

CPUThrottleBehavior sample:

CPUThrottleBehavior cpuThrottler = new CPUThrottleBehavior(maxRequestPerSecond: 100);

while (true)
{
    if (cpuThrottler.AddHit())
    {
        Console.WriteLine("hit registered");
    }
}
Clone this wiki locally