Usage of concurrent rate limit in FaultRule

Not applicable

Hi all,

I am trying to use a concurrent rate limit, and add it in a fault rule to decrement the counter in case of target error.

Concretely, with the above configuration I want to do multiple calls during 10s (the target endpoint response time is < 1s) and haven't concurrent limit when target endpoint replyes an error catched by a fault rule.

<ConcurrentRatelimit async="false" continueOnError="false" enabled="true" name="Concurrent-Rate-Limit">
    <DisplayName>Concurrent Rate Limit</DisplayName>
    <AllowConnections count="1" ttl="10"/>
    <Distributed>true</Distributed>
    <StrictOnTtl>false</StrictOnTtl>
    <TargetIdentifier name=""/>
</ConcurrentRatelimit>

I think this could be a response (FaultRule in target endpoint):

<FaultRules>
        <FaultRule name="500_Error">
            <Step>
                <Name>Concurrent-Rate-Limit</Name>
            </Step>
            <Step>
               ...
            </Step>
            <Condition>(response.status.code = 500)</Condition>
        </FaultRule>
</FaultRules>

But I obtained an ABORT error on the FaultRule Concurent-Rate-Limit step.
In the trace I can see in the properties of the concurent rate limit policy that the enforcement is on the request (in place of response) so it does this error.

How can I correct this ?

My Apigee version is Apigee for private cloud 4.16.09.

0 2 241
2 REPLIES 2

Hmm, I'm not clear. The Concurrent Rate limit policy is intended to limit connections to backend targets. It does not make sense to include a concurrent rate limit policy in a fault rule. It should be applied to the Target Request flow.

I'm sorry, I don't understand what you have written in this sentence:

I want to do multiple calls during 10s (the target endpoint response time is < 1s) and haven't concurrent limit when target endpoint replyes an error catched by a fault rule.

I understand the words, but not the thought. Maybe you could explain using other words, or with a specific example?

Thanks for your response.

Limit the number of connections to backend targets is what I want.

In other words (sorry for my bad english) I want to allow one connection to the target and allow one other connection as soon as the first is ended (even if the ttl is not ended, but StrictOnTtl is false, and even if the target response is 500).

With a correct target response (200) the counter of concurrent rate limit decreases in the target response post flow.

But with a target fault rule that catches an error (status code 500 in my case), it does not pass in the target response post flow. That's why I want to add the concurrent rate limit in my fault rule. Now, if I make 2 successive calls where the target response is 500, the first Apigee response was the one I put in a Raise Fault policy and the second was 503 service unavailable.

Hope this is clearer 🙂