How does ttl attribute work in the Concurrent Rate Limit Policy

Not applicable

The documentation says that ttl is used to automatically decrement the counter after the number of seconds specified. So was wondering what happens to the request that is still at the server and the counter is decremented. For example let say I have set up concurrent policy with

<AllowConnections count="1" ttl="5"/>

and a client makes that first request. The request is still being processed at my server but 5 seconds have passed. The apigee will decrement the counter after 5 seconds. Does this mean the apigee also drop the request and if the server return with the response after 5 second, apigee will just ignore it and client will get some kind of error.

1 3 1,112
3 REPLIES 3

I don't know the answer to this. Good question! Have you tested it? It shouldn't be too hard to test.

Great Question @waqasrehman ,

As you know, Concurrent Rate Limit policy is used to throttle inbound connections to the target server. Using the policy you can define how many number of in-flight connections can be allowed at any point of time to the target server.

TTL attribute & value is mandatory for concurrent rate limit policy. You will define how many number of connections can be allowed using allow attribute.

TTL is used to tell when to decrement the counter. It doesn't drop the connections that are active when new ones are allowed. If the server sends back response after 5 seconds that same will be forwarded to the client. It doesn't result in any error.

Let's take an example, allow - 2, TTL - 5 , Target API Response Time - 20 seconds

Timer

0th Second - API 1 - Allowed - Waiting...

1st Second - API 2 - Allowed - Waiting...

2nd Second - API 3 - Concurrent Rate Limit Restricts - 503 error

3rd Second - API 4 - Concurrent Rate Limit Restricts - 503 error

4th Second - API 5 - Concurrent Rate Limit Restricts - 503 error

5th Second - API 1 TTL expires - 1 more connection allowed

6th Second - API 6 - Allowed - Waiting...

6th Second - API 2 TTL expires - 1 more connection allowed

7th Second - API 6 - Allowed - Waiting...

8th Second - API 7 - Concurrent Rate Limit Restricts - 503 error

9th Second - API 8 - Concurrent Rate Limit Restricts - 503 error

....

21st Second - API 1 Response sent back to client

22nd Second - API 2 Response sent back to client

.....

We have also created a video that demonstrates above concept which also explains how <strictonttl> element works with TTL attribute. Please find the video below.

Hope it helps. Keep us posted if any.

@docs , You might be interested in above video & discussion.