2016-09-26 7 views
2

APIのレート制限を達成するためにwso2-am 2.0.0を使用しています。私は1人のユーザーとAPIを公開し、その後、別のユーザーが購読しています。購読中は、そのAPIの1分あたり20リクエストの購読層を選択しています。また、APIを購読するために使用されたアプリケーションは、毎分50リクエストの制限があります。今、私がAPIをテストしているときに、約50回のリクエスト後にアプリケーションレベルのレート制限が行われています。 APIレベル制限は適用されません。理想的には、ユーザーは20回のリクエスト後にAPIにアクセスできないはずです。私はWindowsマシンを使用して、wso2サーバーとApache JMeterをセットアップしてサーバーに要求を送信しています。私はここで何が欠けていますか?いくつかの助けが必要です...APIレベルのレート制限がwso2で発生しない

+0

既定の高度なスロットリングを使用していますか? – Bee

+0

APIを公開している間、私はこれを設定しました... 高度な調整ポリシー:「APIレベルに適用」を選択し、ドロップダウンから値を「無制限」にしました。 – siddhesh

+0

新しいサブスクリプションポリシー(分あたり20)を正しく作成した場合は、期待どおりに調整する必要があります。 'wso2am-2.0.0/repository/deployment/server/executionplans'に対応するポリシーファイルを投稿できますか? – Bee

答えて

0

ここには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; 
+0

ありがとうございます。これは私が望んだことです – siddhesh