This is Concurrent Rate Limit Policy
<ConcurrentRatelimit async="false" continueOnError="false" enabled="true" name="Concurrent-Rate-Limit-1">
<DisplayName>Concurrent Rate Limit-1</DisplayName>
<AllowConnections count="200" ttl="5"/>
<Distributed>true</Distributed>
<StrictOnTtl>false</StrictOnTtl>
<TargetIdentifier name=""/>
</ConcurrentRatelimit>
I understand that TargetIdentifier name=ββ means I have to Specifies the name of the TargetEndpoint.
- I want to know Can I have 2 TargetIdentifier in the same policy like this :
<TargetIdentifier name="TargetEndpoint1"/>
<TargetIdentifier name="TargetEndpoint2"/>
*I have to 2 Target Endpoints but I want to use only 1 Concurrent Rate Limit.
2.I have many flows in the same TargetEndpoint but I want to use 1 Concurrent Rate Limit/1 Flow. If I add condition for Concurrent Rate Limit, will it works? :
<Request>
<Step>
<Name>Concurrent-Rate-Limit-1</Name>
<Condition>(proxy.pathsuffix MatchesPath "/path1")</Condition>
</Step>
<Step>
<Name>Concurrent-Rate-Limit-2</Name>
<Condition>(proxy.pathsuffix MatchesPath "/path2")</Condition>
</Step>
</Request>
- TargetIdentifier is not exactly the name of target endpoints ,but unique identifier for which concurrent rate limit need to be applied. Apigee docs are a bit misleading on this.
so you can apply same policy/configuration to multiple targets but not using name but using TargetIdentifier as reference to context variables like request headers and other flow variables. For example
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ConcurrentRatelimit async="false" continueOnError="false" enabled="true" name="Concurrent-Rate-Limit-1">
<DisplayName>Concurrent Rate Limit-1</DisplayName>
<AllowConnections count="200" ttl="2"/>
<Distributed>true</Distributed>
<StrictOnTtl>false</StrictOnTtl>
<TargetIdentifier ref="target.name"/>
</ConcurrentRatelimit>
This will maintain separate counter for each value of target.name . Using literal as name is just fixing the identifier to one value but it dosenβt necessarly have to be the name of TargetEndpoint.
- Yes you can use concurrent rate limit with conditions , just make sure to apply the same condition in targets PreFlow-request , PostFlow-response and DefaultFaultRule to avoid inconsistency.
Hope this will help.
2 Likes
Just FYI β ConcurrentRateLimit policy can result in lower throughput. Warning here: https://docs.apigee.com/api-platform/reference/policies/concurrent-rate-limit-policy
1 Like