How to make count as configurable in Spike Arrest

Not applicable

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>

0 2 432
2 REPLIES 2

@Shanish kp

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.

Not applicable

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.