概述
为什么80%的码农都做不了架构师?>>>
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
<dependency>
<groupId>com.marcosbarbero.cloud</groupId>
<artifactId>spring-cloud-zuul-ratelimit</artifactId>
<version>1.0.5.RELEASE</version>
</dependency>
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.
转载于:https://my.oschina.net/itnms/blog/829659
最后
以上就是俏皮硬币为你收集整理的SpringCloudApiGatewayZuul Rate limit流量 控制.md的全部内容,希望文章能够帮你解决SpringCloudApiGatewayZuul Rate limit流量 控制.md所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复