Joke Collection Website - Public benefit messages - SpringCloud uses zuul+ratelimit.

SpringCloud uses zuul+ratelimit.

In the development of micro-services, it is sometimes necessary to restrict the API to prevent network attacks, such as making a short message verification code API. Limiting the client's request rate can resist the short message bombing attack and reduce the loss to some extent. Micro-service gateway is the necessary entrance for every request, which is very suitable for API current limiting and authentication. This paper introduces how Zuul carries out current limiting operation. If you don't know Zuul, please refer to my article: Zuul of SpringCloud Component.

Bucket4j implementation needs related bean @Qualifier("RateLimit "):

Related attributes of the policy

Because we are configured to allow only two requests per second, we will throw too many request exceptions when we exceed it.

This article ends here. For more relevant knowledge, please go to Spring-Cloud-Zul-Rate Limit, and the address of this demo is SpringCloud-Demo.