概述
SpringCloudApiGatewayZuul Rate limit流量 控制.md
访问限速,提供local本地策略【开发】和redis限速【生产】
可以按照每个服务、url、用户、全局进行限速配置
https://github.com/marcosbarbero/spring-cloud-starter-zuul-ratelimit
Spring Cloud Zuul RateLimit
Module to enable rate limit per service in Netflix Zuul.
There are five built-in rate limit approaches:
Authenticated User: Uses the authenticated username or 'anonymous'
Request Origin: Uses the user origin request
URL: Uses the request path of the upstream service
Can be combined with Authenticated User, Request Origin or both
Authenticated User and Request Origin: Combines the authenticated user and the Request Origin
Global configuration per service: This one doesn't validate the request Origin or the Authenticated User
To use this approach just don't set param 'type'
Adding Project Lombok Agent
Usage
This project is available on maven central
Add the dependency on pom.xml
com.marcosbarbero.cloud
spring-cloud-zuul-ratelimit
1.0.5.RELEASE
Sample configuration
zuul:
ratelimit:
enabled: true #default false
behind-proxy: true #default false
policies:
myServiceId:
limit: 10
refresh-interval: 60 #default value (in seconds)
type: url #optional - user - origin - url
zuul Load Shedding Load Shedding - allocating capacity for each type of request and dropping requests that go over the limit.
最后
以上就是花痴酒窝为你收集整理的java api流量控制,SpringCloudApiGatewayZuul Rate limit流量 控制.md的全部内容,希望文章能够帮你解决java api流量控制,SpringCloudApiGatewayZuul Rate limit流量 控制.md所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
发表评论 取消回复