Welcome! Log In Create A New Profile

Advanced

nginx limit_req_module with upstream limit_rate

Posted by Nishikubo Minoru 
Nishikubo Minoru
nginx limit_req_module with upstream limit_rate
March 15, 2017 12:50PM
Hello,

We want to limit outgoing(upstream) rate with the fixed string key among
various virtual hosts as follows:

limit_req_zone fixedstring zone=upstream:1m rate=5000r/s;

server {
server_name vhosta;
logation / {
limit_req zone=upstream burst=25;
proxy_pass http://some_upstream;
}
}
server {
server_name vhostb;
logation / {
limit_req zone=vhostb nodelay;
limit_req zone=upstream burst=25;
proxy_pass http://some_upstream;
}
}

But on our test, the nginx server send to upstream server 6738 requests in
a second.
(The vhosta sent 3677 requests, and the vhostb sent 3061 requests)



It seems that each virtual hosts limits 5000r/s and entire nginx will
10000r/s.
Anyway, we will set limit_req_log_level to info level.
Does anyone know limit_req detailed log information?
Our nginx version is nginx version: nginx/1.10.1
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Maxim Dounin
Re: nginx limit_req_module with upstream limit_rate
March 15, 2017 02:00PM
Hello!

On Wed, Mar 15, 2017 at 08:47:15PM +0900, Nishikubo Minoru wrote:

> We want to limit outgoing(upstream) rate with the fixed string key among
> various virtual hosts as follows:
>
> limit_req_zone fixedstring zone=upstream:1m rate=5000r/s;
>
> server {
> server_name vhosta;
> logation / {

If this is an exact configuration you've tried to test with,
you've probably tested something very different, as there is no
"logation" directive in nginx.

[...]

> But on our test, the nginx server send to upstream server 6738 requests in
> a second.
> (The vhosta sent 3677 requests, and the vhostb sent 3061 requests)

Note that testing exact number of requests in a particular second
doesn't really make sense as small time difference in time will
introduce large errors. Try measuring the average rate of
requests for a larger period of time.

> It seems that each virtual hosts limits 5000r/s and entire nginx will
> 10000r/s.

No, this is not how it works.

> Anyway, we will set limit_req_log_level to info level.
> Does anyone know limit_req detailed log information?

Detailed information can be found in debug log, see
http://nginx.org/en/docs/debugging_log.html.

--
Maxim Dounin
http://nginx.org/
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Nishikubo Minoru
Re: nginx limit_req_module with upstream limit_rate
March 15, 2017 03:20PM
> If this is an exact configuration you've tried to test with,
> you've probably tested something very different, as there is no
> "logation" directive in nginx.

Oh, location is correct.

http {
limit_req_zone fixedstring zone=upstream:1m rate=5000r/s;
}

server {
server_name vhosta;
location / {
limit_req zone=upstream burst=25;
proxy_pass http://some_upstream;
}
}
server {
server_name vhostb;
location / {
limit_req zone=vhostb nodelay;
limit_req zone=upstream burst=25;
proxy_pass http://some_upstream;
}
}

> > It seems that each virtual hosts limits 5000r/s and entire nginx will
> > 10000r/s.
>
> No, this is not how it works.

Thanks for explict answer.

> Detailed information can be found in debug log, see
> http://nginx.org/en/docs/debugging_log.html.

We will try, thanks again.


On Wed, Mar 15, 2017 at 9:50 PM, Maxim Dounin <[email protected]> wrote:

> Hello!
>
> On Wed, Mar 15, 2017 at 08:47:15PM +0900, Nishikubo Minoru wrote:
>
> > We want to limit outgoing(upstream) rate with the fixed string key among
> > various virtual hosts as follows:
> >
> > limit_req_zone fixedstring zone=upstream:1m rate=5000r/s;
> >
> > server {
> > server_name vhosta;
> > logation / {
>
> If this is an exact configuration you've tried to test with,
> you've probably tested something very different, as there is no
> "logation" directive in nginx.
>
> [...]
>
> > But on our test, the nginx server send to upstream server 6738 requests
> in
> > a second.
> > (The vhosta sent 3677 requests, and the vhostb sent 3061 requests)
>
> Note that testing exact number of requests in a particular second
> doesn't really make sense as small time difference in time will
> introduce large errors. Try measuring the average rate of
> requests for a larger period of time.
>
> > It seems that each virtual hosts limits 5000r/s and entire nginx will
> > 10000r/s.
>
> No, this is not how it works.
>
> > Anyway, we will set limit_req_log_level to info level.
> > Does anyone know limit_req detailed log information?
>
> Detailed information can be found in debug log, see
> http://nginx.org/en/docs/debugging_log.html.
>
> --
> Maxim Dounin
> http://nginx.org/
> _______________________________________________
> nginx mailing list
> nginx@nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx
>
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Nishikubo Minoru
Re: nginx limit_req_module with upstream limit_rate
March 15, 2017 05:20PM
I noticed our nginx configuration 5000r/s limits, that is the test program
must generate requests between less than 0.2msec, the tester was
misconfigured the test condition.
Thanks for great hint :-)

On Wed, Mar 15, 2017 at 11:19 PM, Nishikubo Minoru <[email protected]>
wrote:

> > If this is an exact configuration you've tried to test with,
> > you've probably tested something very different, as there is no
> > "logation" directive in nginx.
>
> Oh, location is correct.
>
> http {
> limit_req_zone fixedstring zone=upstream:1m rate=5000r/s;
> }
>
> server {
> server_name vhosta;
> location / {
> limit_req zone=upstream burst=25;
> proxy_pass http://some_upstream;
> }
> }
> server {
> server_name vhostb;
> location / {
> limit_req zone=vhostb nodelay;
> limit_req zone=upstream burst=25;
> proxy_pass http://some_upstream;
> }
> }
>
> > > It seems that each virtual hosts limits 5000r/s and entire nginx will
> > > 10000r/s.
> >
> > No, this is not how it works.
>
> Thanks for explict answer.
>
> > Detailed information can be found in debug log, see
> > http://nginx.org/en/docs/debugging_log.html.
>
> We will try, thanks again.
>
>
> On Wed, Mar 15, 2017 at 9:50 PM, Maxim Dounin <[email protected]> wrote:
>
>> Hello!
>>
>> On Wed, Mar 15, 2017 at 08:47:15PM +0900, Nishikubo Minoru wrote:
>>
>> > We want to limit outgoing(upstream) rate with the fixed string key among
>> > various virtual hosts as follows:
>> >
>> > limit_req_zone fixedstring zone=upstream:1m rate=5000r/s;
>> >
>> > server {
>> > server_name vhosta;
>> > logation / {
>>
>> If this is an exact configuration you've tried to test with,
>> you've probably tested something very different, as there is no
>> "logation" directive in nginx.
>>
>> [...]
>>
>> > But on our test, the nginx server send to upstream server 6738 requests
>> in
>> > a second.
>> > (The vhosta sent 3677 requests, and the vhostb sent 3061 requests)
>>
>> Note that testing exact number of requests in a particular second
>> doesn't really make sense as small time difference in time will
>> introduce large errors. Try measuring the average rate of
>> requests for a larger period of time.
>>
>> > It seems that each virtual hosts limits 5000r/s and entire nginx will
>> > 10000r/s.
>>
>> No, this is not how it works.
>>
>> > Anyway, we will set limit_req_log_level to info level.
>> > Does anyone know limit_req detailed log information?
>>
>> Detailed information can be found in debug log, see
>> http://nginx.org/en/docs/debugging_log.html.
>>
>> --
>> Maxim Dounin
>> http://nginx.org/
>> _______________________________________________
>> nginx mailing list
>> nginx@nginx.org
>> http://mailman.nginx.org/mailman/listinfo/nginx
>>
>
>
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Sorry, only registered users may post in this forum.

Click here to login