Forum: NGINX dynamic rate limiting per ip

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
2974d09ac2541e892966b762aad84943?d=identicon&s=25 theotow (Guest)
on 2014-01-02 21:55
(Received via mailing list)
Hello Folks,

i have some setup with multiple server and i offer downloads for the
users,
in the case my servers bandwidth is overloaded i want the people to be
able
to start the download but with limited rate so the don't have to wait in
some kind of queue till the get there downloadlink. As soon as some
slots
frees the person highest in the queue download rate should increase to
the
max.

Any Ideas if this is possible with the limit_rate of the http core
module
and lua?

If it would be possible to make 2 zone dicts where the ips of the the
slow
and fast connections are in. And if someone ratelimit is dropped his ip
gets
removed from the slow dict and added to the fast dict.

https://github.com/chaoslawful/lua-nginx-module#ng...

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,245957,245957#msg-245957
2974d09ac2541e892966b762aad84943?d=identicon&s=25 theotow (Guest)
on 2014-01-06 17:08
(Received via mailing list)
nobody an idea?

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,245957,246064#msg-246064
37f3ea777f96500b332a1a89d6027897?d=identicon&s=25 Yichun Zhang (agentzh) (Guest)
on 2014-01-06 20:33
(Received via mailing list)
Hello!

On Thu, Jan 2, 2014 at 12:54 PM, theotow wrote:
>
> Any Ideas if this is possible with the limit_rate of the http core module
> and lua?
>

You can use ngx_lua alone to do this.

> If it would be possible to make 2 zone dicts where the ips of the the slow
> and fast connections are in. And if someone ratelimit is dropped his ip gets
> removed from the slow dict and added to the fast dict.
>
> https://github.com/chaoslawful/lua-nginx-module#ng...
>

Yes, you can surely do that. You can use ngx.sleep() to hold back the
exceeding clients without blocking other requests served by the same
nginx worker.

Regards,
-agentzh
This topic is locked and can not be replied to.