API wso2 中没有等级速率限制
API level rate limiting not happening in wso2
我正在使用 wso2-am 2.0.0 来实现 APIs 的速率限制。我与一个用户发布了一个 API,然后另一个用户订阅了它。订阅时,我为此选择了每分钟 20 个请求的订阅层 API。此外,用于订阅 API 的应用程序每分钟有 50 个请求的限制。现在,当我测试 API 时,在大约 50 个请求后仅发生应用程序级别速率限制。 API 级别限制不适用。理想情况下,用户在 20 次请求后应该无法访问 API。我正在使用 windows 机器来设置 wso2 服务器和 Apache JMeter 以向服务器发送请求。我在这里错过了什么?需要一些帮助...
这是4MB/s
政策。
@Plan:name('carbon.super_app_BandwidthPolicy')
@Plan:description('ExecutionPlan for app_BandwidthPolicy')
@Import('org.wso2.throttle.processed.request.stream:1.0.0')
define stream RequestStream (messageID string, appKey string, appTier string, subscriptionKey string, apiKey string, apiTier string, subscriptionTier string, resourceKey string, resourceTier string, userId string, apiContext string, apiVersion string, appTenant string, apiTenant string, appId string, apiName string, propertiesMap string);
@Export('org.wso2.throttle.globalThrottle.stream:1.0.0')
define stream GlobalThrottleStream (throttleKey string, isThrottled bool, expiryTimeStamp long);
FROM RequestStream
SELECT messageID, (appTenant == 'carbon.super' and appTier == 'BandwidthPolicy') AS isEligible, appKey AS throttleKey, propertiesMap
INSERT INTO EligibilityStream;
FROM EligibilityStream[isEligible==true]#throttler:timeBatch(1 min, 0)
select throttleKey, (sum(cast(map:get(propertiesMap,'messageSize'),'long')) >= 4194304) as isThrottled, expiryTimeStamp group by throttleKey
INSERT ALL EVENTS into ResultStream;
from ResultStream#throttler:emitOnStateChange(throttleKey, isThrottled)
select *
insert into GlobalThrottleStream;
我正在使用 wso2-am 2.0.0 来实现 APIs 的速率限制。我与一个用户发布了一个 API,然后另一个用户订阅了它。订阅时,我为此选择了每分钟 20 个请求的订阅层 API。此外,用于订阅 API 的应用程序每分钟有 50 个请求的限制。现在,当我测试 API 时,在大约 50 个请求后仅发生应用程序级别速率限制。 API 级别限制不适用。理想情况下,用户在 20 次请求后应该无法访问 API。我正在使用 windows 机器来设置 wso2 服务器和 Apache JMeter 以向服务器发送请求。我在这里错过了什么?需要一些帮助...
这是4MB/s
政策。
@Plan:name('carbon.super_app_BandwidthPolicy')
@Plan:description('ExecutionPlan for app_BandwidthPolicy')
@Import('org.wso2.throttle.processed.request.stream:1.0.0')
define stream RequestStream (messageID string, appKey string, appTier string, subscriptionKey string, apiKey string, apiTier string, subscriptionTier string, resourceKey string, resourceTier string, userId string, apiContext string, apiVersion string, appTenant string, apiTenant string, appId string, apiName string, propertiesMap string);
@Export('org.wso2.throttle.globalThrottle.stream:1.0.0')
define stream GlobalThrottleStream (throttleKey string, isThrottled bool, expiryTimeStamp long);
FROM RequestStream
SELECT messageID, (appTenant == 'carbon.super' and appTier == 'BandwidthPolicy') AS isEligible, appKey AS throttleKey, propertiesMap
INSERT INTO EligibilityStream;
FROM EligibilityStream[isEligible==true]#throttler:timeBatch(1 min, 0)
select throttleKey, (sum(cast(map:get(propertiesMap,'messageSize'),'long')) >= 4194304) as isThrottled, expiryTimeStamp group by throttleKey
INSERT ALL EVENTS into ResultStream;
from ResultStream#throttler:emitOnStateChange(throttleKey, isThrottled)
select *
insert into GlobalThrottleStream;