Hello Everyone,
I got to use nginx plus to build a rate limiting solution for my project.
nginx configurations looks like below,
http {
limit_req_zone $binary_remote_addr zone=one:10m rate=1r/s;
server {
...
location /search/ {
limit_req zone=one burst=5;
}
}
Project Requirement:
- Request rate limiting policy will be maintained by a separate service managing rate limiting policy. e.g. Consumer ‘C’ consumes Service ‘A’ with rate ‘x’ requests per ‘time unit‘.
- Application team member is supposed to modify rate limiting policy using a self service model.
- As soon as rate limiting policy changes, nginx is supposed to read policy and translate it into equivalent nginx configurations and apply them immediately.
- There should not be any downtime while applying new rate-limiting policy.
Below Options Explored:
Option #1: Use nginx plus apis to change nginx rate limiting configurations.
Findings: Nginx plus does not provide any api with which rate can be changes from directive ‘limit_req_zone’
Option #2: Use of nginx java script module to programmatically connect to external source and re-build rate limiting configurations
Findings: It does not seem to be possible to modify rate limiting configurations either.
Option #3: Use nginx-agent to manage nginx plus configurations via control server using http rest api.
Findings: We could successfully could apply latest nginx configurations using a control server by making ‘config apply’ http requests.
Questions:
- Is my above understanding correct? feel free to leave your comments.
- Is there any other better way to apply configs dynamically ?
Thank you..!