I'm trying to understand why rate limits are being hit so early. I have a policy where I have rate limits set on an API Plan. The rate limit should kick in at about 200 req/sec. I notice that the threshold hits far sooner than that. Can someone help me understand how this is supposed to work?
Here is my assertion:
I expect failures at around 200 req/sec for a given API Key + API Plan combination. I see failures at 15 - 20 requests/second.
Here is my response from the gateway:
API plan limit exceeded
Reason: Not Setl <api-key> | <api-plan> |quota?ok|rate?failed|
Where <api-key> and <api-plan> line up with the client and plan IDs that I expect to be involved.
I'm using Jmeter to drive traffic to the gateway. The thread group uses 30 threads and only loops once. I bail the test after the first failure. The failures start at about 15-20 requests/second.
Any help is appreciated!
Hello Alejandro ,
Your settings of rate limit is cluster wide, so, how many nodes in the cluster? the exact number for each node will be divided by the number of nodes.
ie. if you have 2 nodes, the exact rate limit is 100/sec
Note that beside API plan, there is also Account plan, ie. there is at least 2 rate limit assertions, check if the traffic was blocked by another rate limit assertion.
Also you need to meet the throughput quota in both api plan and account plan.
Thanks. I checked into those as well. I have two nodes in a cluster. Even with this setup, the limit is reached before divided count.
I traced which assertion is firing and it is definitely the rate limit one.
One thing I noticed is that adjusting the "spread limit over" seemed to help a bit. Trouble is, I can't really set this if the portal is re-writing these assertions when API plans are updated.
Just a couple things to note. The "spread over limit" would help as this is viewed as a buffer, for when going over the limit. So if you continue to play around with these values you will see the difference.
Also, the assertions don't get updated so to speak. The policies have built in logic that do a lookup for things such as API Plans, Limit, etc... So every time you update them in Portal, the change would take effect when the Policy gets hit, in turn looking up the new value.
I hope this clarifies.
Just replying to myself... This seems to line up with what I was experiencing in my original post. Hopefully it helps someone else down the line:
Encountering an "API Plan Limit Exceeded" Error Even When Traffic Is Well Underneath the Set Rate Limit.