java api流量控制,SpringCloudApiGatewayZuul Rate limit流量 控制.md

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.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值