Welcome! Log In Create A New Profile

Advanced

Re: Nginx $upstream_cache_status not available when used in rate limiting

Francis Daly
July 20, 2016 05:30PM
On Wed, Jul 20, 2016 at 02:52:10PM -0400, linnading wrote:

Hi there,

> It is "to the same upstream server" that I care about. I would like to
> limit the request rate to the same upstream server.

That makes sense, thanks.

I am not aware of a way to achieve this directly in stock nginx.

I see that there is a third-party module at
https://github.com/cfsego/nginx-limit-upstream which looks like
it aims to do what you want; and I see that nginx-plus has a
"max_conns" value per server in an upstream block, documented at
http://nginx.org/en/docs/http/ngx_http_upstream_module.html#server

If non-stock is ok for you, possibly one of those can work?

> The Scenarios is like:
> 10 requests at the same time to the same upstream server, the upstream
> server should only receive requests at rate 1r/m. Last few requests will be
> delayed or rejected. But for these last few requests, some of them can be
> served by cache, they should not be delayed/rejected.

I think that the limit_* directives implementation is such that the
choice is made before the upstream is chosen; and there are no explicit
limits on the connections to upstream. That is likely why the third-party
module was created.

Cheers,

f
--
Francis Daly francis@daoine.org

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

Nginx $upstream_cache_status not available when used in rate limiting

Linna.Ding July 18, 2016 03:28PM

Re: Nginx $upstream_cache_status not available when used in rate limiting

linnading July 20, 2016 02:03PM

Re: Nginx $upstream_cache_status not available when used in rate limiting

Francis Daly July 20, 2016 02:18PM

Re: Nginx $upstream_cache_status not available when used in rate limiting

linnading July 20, 2016 02:52PM

Re: Nginx $upstream_cache_status not available when used in rate limiting

Francis Daly July 20, 2016 05:30PM

Re: Nginx $upstream_cache_status not available when used in rate limiting

Valentin V. Bartenev July 20, 2016 05:56PM

Re: Nginx $upstream_cache_status not available when used in rate limiting

linnading July 21, 2016 10:51AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 244
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready