Hi
Is there any way we can give reference variable for count in spike arrest policy?
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<SpikeArrest async="false" continueOnError="false" enabled="true" name="Spike-Arrest-2"> <DisplayName>Spike Arrest-2</DisplayName>
<Properties/> <Identifier ref="request.header.some-header-name"/>
<MessageWeight ref="request.header.weight"/>
<Rate>30ps</Rate> </SpikeArrest>
My requirement is , this count need to be configurable like from KVM .
I can achieve this in Quota policy , but the issue is I can give unit minimum in minutes . Requirement is 5 trx / sec and if in case 6th trx in sec it should give error . I have given as 300 per minute , but there will be chance 10 trx can come in first second itself , which is exceeding 5 trx /sec .
Is this I can achieve only via Spike arrest (because if i give 300 pm , then it will divide 5 per sec ) ? If yes how I can make count as configurable ?
Or
Is there any way I can achieve this by quota? ie per second transaction.
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Quota async="false" continueOnError="false" enabled="true" name="PartnerRateLimit"> <DisplayName>PartnerRateLimit</DisplayName>
<Properties/> <Allow countRef="partnerRateLimitCount"/>
<Interval ref="request.header.quota_count">1</Interval>
<Distributed>true</Distributed>
<Synchronous>true</Synchronous>
<TimeUnit ref="request.header.quota_timeout">minute</TimeUnit>
<Identifier ref="company.name"/>
</Quota>
Answer by AMAR DEVEGOWDA · Nov 30, 2017 at 05:12 AM
You can set the "Rate" element in Spike Arrest policy using a variable. Refer to Samples section and "Rate" element in Spike Arrest policy documentation for more details.
Here's the sample on how you can use the variable for the Rate element for your reference:
<SpikeArrest name="SpikeArrest"> <Rate ref="request.header.rate" /> </SpikeArrest>
The variable value must be in the form of {int}pm or {int}ps.
Also do refer to Comparing Quota, Spike Arrest, and Concurrent Rate Limit Policies documentation. It would help you to understand and choose the right/best policy based on your requirements.
Answer by Muhammad Imran Khan
·
Nov 30, 2017 at 06:00 AM
Hi Shanish kp
If there will be a chance of 10 transactions can come in first second itself than it is not possible either using quota or spike arrest. However, you can create your own custom logic using javascript.
What are the maximum values of spike arrest and quota? 1 Answer
How to restrict calls to Backend based on Access Token 2 Answers
"Punish" with SpikeArrest? 1 Answer
How to does Quota and Spike Arrest policy work when in a shared flow?. 1 Answer
Spike Arrest retry time to be calculated to convey user 1 Answer