Nginx Rate limiting for HTTPS requests

Maxim Dounin mdounin at mdounin.ru
Tue May 22 18:01:01 UTC 2018


Hello!

On Tue, May 22, 2018 at 12:37:18PM -0400, rickGsp wrote:

> >>- Make sure the $host variable you use for the limiting is not 
> >>empty and not changed between requests created by your testing 
> >>tool. Try logging the variable to see if it changes or not. 
> >>Alternatively, replace it with a static string to see if it helps.
> 
> Checked. $host variable is set for all the requests.
> 
> >>- Make sure there are no unrelated requests in the log. In 
> >>particular, you may want to use different logs in the server{} 
> >>block you are limiting and in the http{} block.
> 
> Checked. There are no unrelated requests in the log.
> 
> >>- Try another tool to see if you are able to reproduce the same 
> >>effect. Something simple like "ab" or "http_load" might be a 
> >>good choice.
> 
> Checked with "ab" with as following (concurrency 700 requests);
> ab -n 20000 -c 700 https://9.0.0.10:443/test.html
> 
> Here is the piece of output. As per the report test ran for approx. 50
> seconds and 20000-14622 = 5278 requests returned with success. This is as
> expected as per rate limiting at 100r/s for 50 seconds test. Notice that
> Mean requests processed per second is 396.
> 
> Concurrency Level:      700
> Time taken for tests:   50.437 seconds
> Complete requests:      20000
> Failed requests:        14722
> Requests per second:    396.53 [#/sec] (mean)
> 
> Access log report for this test as per the following command seems to be
> fine: grep ' 200 ' /path/to/log | awk '{print $4}' | uniq -c
>    111 [22/May/2018:15:35:04
>     101 [22/May/2018:15:35:05
>      95 [22/May/2018:15:35:06
>      98 [22/May/2018:15:35:07
>      97 [22/May/2018:15:35:08
>     106 [22/May/2018:15:35:09
>      95 [22/May/2018:15:35:10
>      99 [22/May/2018:15:35:11
>     104 [22/May/2018:15:35:12
>     106 [22/May/2018:15:35:13
> 
> 
> In another test, I ran two instances of "ab" in parallel with same
> configuration and following is the output.This is again approx. 50 seconds
> test. By combining both the reports (20000+20000) - (9344+10239) = 20417
> requests returned with success. This is four times of expected 5000
> requests/sec rate. I would like to understand this behaviour. I guess this
> is happening in my tests as well. In my case I just keep pushing requests
> without waiting for response.
> 
> First instance:
> Concurrency Level:      700
> Time taken for tests:   46.944 seconds
> Complete requests:      20000
> Failed requests:        9344
> Requests per second:    426.04 [#/sec] (mean)
> 
> Second Instance:
> Concurrency Level:      700
> Time taken for tests:   53.344 seconds
> Complete requests:      20000
> Failed requests:        10239
> Requests per second:    374.92 [#/sec] (mean)
> 
> 
> Access log report for this test as per the following command does not seem
> to be fine: grep ' 200 ' /path/to/log | awk '{print $4}' | uniq -c
>     180 [22/May/2018:15:52:59
>     276 [22/May/2018:15:53:00
>      33 [22/May/2018:15:53:01
>      20 [22/May/2018:15:53:00
>      70 [22/May/2018:15:53:01
>       1 [22/May/2018:15:53:00
>     181 [22/May/2018:15:53:01
>      16 [22/May/2018:15:53:02
>       2 [22/May/2018:15:53:01
>      99 [22/May/2018:15:53:02
>       1 [22/May/2018:15:53:01
>     177 [22/May/2018:15:53:02
>     329 [22/May/2018:15:53:03
>       8 [22/May/2018:15:53:02

Please show "uname -a", "nginx -V", and "ps -alxww | grep nginx" 
output.

-- 
Maxim Dounin
http://mdounin.ru/


More information about the nginx mailing list