You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by "ro4i7 (via GitHub)" <gi...@apache.org> on 2023/03/12 15:29:41 UTC

[GitHub] [apisix] ro4i7 commented on issue #6197: request help: How to current limit both in minutes and day by using plugin limit-count

ro4i7 commented on issue #6197:
URL: https://github.com/apache/apisix/issues/6197#issuecomment-1465228335

   Hello @spacewander @membphis @123libohan 
   please assign it to me and give the feedback on the following solution;
   
   To limit both in minutes and days using the `limit-count` plugin, we can create two separate rules for the different time periods. One rule can limit the requests per minute, while the other rule can limit the requests per day.
   
   a configuration for limiting requests to 1000 per minute and 50000 per day:
   ```
   plugins:
     limit-count:
       minute: 1000
       hour: 0
       day: 0
       month: 0
       year: 0
       key: "${remote_addr}"
       rejected_code: 503
       redis_host: "127.0.0.1"
       redis_port: 6379
       dict_name: "limit_count"
   
     limit-count-daily:
       minute: 0
       hour: 0
       day: 1
       month: 0
       year: 0
       key: "${remote_addr}"
       rejected_code: 503
       redis_host: "127.0.0.1"
       redis_port: 6379
       dict_name: "limit_count_daily"
   ```
   The first rule `limit-count` limits the requests to 1000 per minute, and the second rule `limit-count-daily` limits the requests to 50000 per day. We can adjust the limits and the time periods as needed.
   
   I have used `Redis` as the storage backend for the `limit-count` plugin. We may need to adjust the `redis_host` and `redis_port` settings to match our Redis configuration.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org