Nginx Rate limiting for HTTPS requests
Maxim Dounin
mdounin at mdounin.ru
Mon May 21 16:44:26 UTC 2018
Hello!
On Mon, May 21, 2018 at 09:55:20AM -0400, rickGsp wrote:
> >>I'm pretty sure the problem is with your tests, not with nginx
> >>request rate limiting. Unfortunately, it is not possible to
> >>reproduce your tests and check what's going wrong as you are using
> >>proprietary software for tests.
>
> >>As suggested previously, it might be a good idea to verify numbers
> >>using nginx access logs. Seeing numbers of requests per seconds
> >>should be as trivial as
>
> >>grep ' 200 ' /path/to/log | awk '{print $4}' | uniq -c
>
> >>assuming default log format and only test requests in the log.
>
> Hi Maxim,
>
> Here is a piece of output for the following command as per our success
> return value as 202.
> grep ' 202 ' /path/to/log | awk '{print $4}' | uniq -c
>
> 232 [17/May/2018:03:46:03
> 171 [17/May/2018:03:46:04
> 101 [17/May/2018:03:46:05
> 124 [17/May/2018:03:46:06
> 169 [17/May/2018:03:46:07
> 105 [17/May/2018:03:46:08
> 5 [17/May/2018:03:46:09
> 1 [17/May/2018:03:46:08
> 218 [17/May/2018:03:46:09
> 104 [17/May/2018:03:46:10
> 269 [17/May/2018:03:46:11
> 130 [17/May/2018:03:46:12
> 97 [17/May/2018:03:46:13
> 96 [17/May/2018:03:46:14
> 124 [17/May/2018:03:46:15
> 248 [17/May/2018:03:46:16
> 237 [17/May/2018:03:46:17
> 126 [17/May/2018:03:46:18
This certainly does not look right. Either there are some
unrelated requests in the log, or requests are not limited as it
can be expected from your configuration. Some additional things
to check:
- 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.
- 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.
- 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.
--
Maxim Dounin
http://mdounin.ru/
More information about the nginx
mailing list