On Mon, Dec 21, 2015 at 11:00:09AM +0100, Stefan Hellkvist wrote: > Hi, > > From reading the code and the docs I have gotten the impression that > limit_rate (and limit_rate_after) is per ngx_connection which (I think) > means that it is per HTTP request and not per socket. Am I right in this > conclusion or is the limit actually per socket/TCP connection?
The docs at http://nginx.org/r/limit_rate says it clearly that the limit is set per a request, and describes one of the possible cases how this limit can be "avoided" by the client. The limit is implemented on the ngx_connection_t level which is usually mapped 1:1 to a physical connection. > What we are observing is that the limit we configure does only kick in for > requests to files that are larger than the limit_rate_after when the > request is done in one GET request but not when the request is done in > chunks using byte offset parameters (that is - using many GET requests for > the file). So clients can easily avoid the limitations by downloading the > file chunk by chunk rather than in one request. Opening several connections, or using SPDY/HTTP2 is another way to jump over the limit. > If our conclusion are right - that the limit is per HTTP request and not > per socket so that a chunked download would not be limited - does anyone > have any suggestion how we would go about to introduce a limit also on > socket level? I don't mind hacking away at the code, but perhaps someone > out there has already looked into this? I know that Valentin (CC:ed) was working on the limit_rate module that improves things, including variables support and extening the limitation beyond only "per request". It should become possible to limit byte rate per IP, for example. _______________________________________________ nginx-devel mailing list [email protected] http://mailman.nginx.org/mailman/listinfo/nginx-devel
