S
S
Stepgor2020-10-23 01:50:08
Nginx
Stepgor, 2020-10-23 01:50:08

What is the best way to implement a request limit in a project?

What is the best way to implement request limit per time span across multiple servers.
The simplest option, probably, will be to access the database on each request and add information about the new request, if there are more than necessary - give the user an error, am I right?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
W
wassapman72, 2020-10-23
@wassapman72

contacting the database on each request to calculate it - this is not the best way for many reasons (load, support for your self-written rate limit, and another thousand). read https://www.nginx.com/blog/rate-limiting-nginx/
or here nginx.org/ru/docs/http/ngx_http_limit_req_module.html and most likely this will be enough.
you can use 1 nginx as a loadbalancer, you can configure it on each of the nginx.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question