Kong常用plugin-03-Rate Limiting

Rate Limiting 訪問速率控制

Rate limit how many HTTP requests a developer can make in a given period of seconds, minutes, hours, days, months or years. If the API has no authentication layer, the Client IP address will be used, otherwise the Consumer will be used if an authentication plugin has been configured.

訪問速率的控制維度有時分秒年月,如果沒有配置身份認證信息這一層,則使用客戶端IP,否則根據用戶(consumer)的信息來標記控制訪問

給test-service添加rate limit,現在用戶訪問服務的速率,如果沒有配置consumer,則使用IP。

限制方式:如果沒有consumer配置,則使用IP

限制策略,此爲可選配置,三個值:

local:計數器存儲在本地內存中的節點上。

cluster:計數器存儲在kong的數據存儲區中【我此處爲PostgreSQL】,並在節點之間共享。(默認值)

redis:計數器存儲在Redis服務器上並在節點之間共享。

當訪問服務時每秒或者每分鐘達到2次,則提示錯誤:

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章