Per IP bandwidth limit

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

Per IP bandwidth limit

Kostya Velychkovsky
Hello, is it the correct way to limit download/upload speed per client IP,  at the same time ignore how many connections it opens and request rate produced?

I need just limit bandwidth for example  100 mbit/s per IP, and no matter it opens 1 connection or 100 simulation connections. 

--
Best Regards 

Kostiantyn Velychkovsky 

_______________________________________________
nginx mailing list
[hidden email]
http://mailman.nginx.org/mailman/listinfo/nginx
Reply | Threaded
Open this post in threaded view
|

Re: Per IP bandwidth limit

Christos Chatzaras

> On 11 Nov 2019, at 15:09, Kostya Velychkovsky <[hidden email]> wrote:
>
> Hello, is it the correct way to limit download/upload speed per client IP,  at the same time ignore how many connections it opens and request rate produced?
>
> I need just limit bandwidth for example  100 mbit/s per IP, and no matter it opens 1 connection or 100 simulation connections.
>

Maybe it's better to do this with firewall. For example in FreeBSD this can be done with IPFW + Dummynet.
_______________________________________________
nginx mailing list
[hidden email]
http://mailman.nginx.org/mailman/listinfo/nginx
Reply | Threaded
Open this post in threaded view
|

Re: Per IP bandwidth limit

Kostya Velychkovsky
I use Linux, and had a bad experience with Linux shaper (native kernel QoS mechanism - tc ), it consumed a lot of CPU and worked unstable. So I rejected the idea to keep using it. 

пн, 11 нояб. 2019 г. в 15:23, Christos Chatzaras <[hidden email]>:

> On 11 Nov 2019, at 15:09, Kostya Velychkovsky <[hidden email]> wrote:
>
> Hello, is it the correct way to limit download/upload speed per client IP,  at the same time ignore how many connections it opens and request rate produced?
>
> I need just limit bandwidth for example  100 mbit/s per IP, and no matter it opens 1 connection or 100 simulation connections.
>

Maybe it's better to do this with firewall. For example in FreeBSD this can be done with IPFW + Dummynet.
_______________________________________________
nginx mailing list
[hidden email]
http://mailman.nginx.org/mailman/listinfo/nginx


--
Best Regards 

Kostiantyn Velychkovsky 

_______________________________________________
nginx mailing list
[hidden email]
http://mailman.nginx.org/mailman/listinfo/nginx
Reply | Threaded
Open this post in threaded view
|

Re: Per IP bandwidth limit

Peter Booth
Why do you want to do this at all? 
What is the real underlying problem that you are attempting to solve?



On Nov 11, 2019, at 8:29 AM, Kostya Velychkovsky <[hidden email]> wrote:

I use Linux, and had a bad experience with Linux shaper (native kernel QoS mechanism - tc ), it consumed a lot of CPU and worked unstable. So I rejected the idea to keep using it. 

пн, 11 нояб. 2019 г. в 15:23, Christos Chatzaras <[hidden email]>:

> On 11 Nov 2019, at 15:09, Kostya Velychkovsky <[hidden email]> wrote:
>
> Hello, is it the correct way to limit download/upload speed per client IP,  at the same time ignore how many connections it opens and request rate produced?
>
> I need just limit bandwidth for example  100 mbit/s per IP, and no matter it opens 1 connection or 100 simulation connections.
>

Maybe it's better to do this with firewall. For example in FreeBSD this can be done with IPFW + Dummynet.
_______________________________________________
nginx mailing list
[hidden email]
http://mailman.nginx.org/mailman/listinfo/nginx


--
Best Regards 

Kostiantyn Velychkovsky 
_______________________________________________
nginx mailing list
[hidden email]
http://mailman.nginx.org/mailman/listinfo/nginx


_______________________________________________
nginx mailing list
[hidden email]
http://mailman.nginx.org/mailman/listinfo/nginx
Reply | Threaded
Open this post in threaded view
|

Re: Per IP bandwidth limit

Kostya Velychkovsky
I have big data storage, some clients upload files to it, some download, some clients might upload a lot of small files in 100-200 parallel connections, but using only 20-30 mbit/s bandwidth, some clients can put big files in 10 parallel connections but using - 3Gbit/s bandwidth. The same situation with download. So, the first situation is normal behavior and I can't afford to limit connection number per IP, in the second case it's bandwidth overload, but I can't limit bandwidth per IP, because <a href="http://nginx.org/ru/docs/http/ngx_http_core_module.html#limit_rate"> limit_rate</a> directive is working per request only. In general case, I just need to limit bandwidth from 1 IP, independently how many parallel TCP connections per IP used by client 10 or 100.

пн, 11 нояб. 2019 г. в 20:06, Peter Booth <[hidden email]>:
Why do you want to do this at all? 
What is the real underlying problem that you are attempting to solve?



On Nov 11, 2019, at 8:29 AM, Kostya Velychkovsky <[hidden email]> wrote:

I use Linux, and had a bad experience with Linux shaper (native kernel QoS mechanism - tc ), it consumed a lot of CPU and worked unstable. So I rejected the idea to keep using it. 

пн, 11 нояб. 2019 г. в 15:23, Christos Chatzaras <[hidden email]>:

> On 11 Nov 2019, at 15:09, Kostya Velychkovsky <[hidden email]> wrote:
>
> Hello, is it the correct way to limit download/upload speed per client IP,  at the same time ignore how many connections it opens and request rate produced?
>
> I need just limit bandwidth for example  100 mbit/s per IP, and no matter it opens 1 connection or 100 simulation connections.
>

Maybe it's better to do this with firewall. For example in FreeBSD this can be done with IPFW + Dummynet.
_______________________________________________
nginx mailing list
[hidden email]
http://mailman.nginx.org/mailman/listinfo/nginx


--
Best Regards 

Kostiantyn Velychkovsky 
_______________________________________________
nginx mailing list
[hidden email]
http://mailman.nginx.org/mailman/listinfo/nginx

_______________________________________________
nginx mailing list
[hidden email]
http://mailman.nginx.org/mailman/listinfo/nginx


--
Best Regards 

Kostiantyn Velychkovsky 

_______________________________________________
nginx mailing list
[hidden email]
http://mailman.nginx.org/mailman/listinfo/nginx
Reply | Threaded
Open this post in threaded view
|

Re: Per IP bandwidth limit

lists@lazygranch.com
I am not currently using any bandwidth limiting features so I can't comment on how it is done currently. However in the past I use the one built into Nginx and tested it with a download manager. My recollection is you could open more streams but the net effect was the download stayed at the same rate. I was impressed.

I have gone to http2, so I don't know if the rate limiting features are still valid. 

Sent: November 11, 2019 10:50 AM
Reply-to: [hidden email]
Subject: Re: Per IP bandwidth limit

I have big data storage, some clients upload files to it, some download, some clients might upload a lot of small files in 100-200 parallel connections, but using only 20-30 mbit/s bandwidth, some clients can put big files in 10 parallel connections but using - 3Gbit/s bandwidth. The same situation with download. So, the first situation is normal behavior and I can't afford to limit connection number per IP, in the second case it's bandwidth overload, but I can't limit bandwidth per IP, because <a href="http://nginx.org/ru/docs/http/ngx_http_core_module.html#limit_rate"> limit_rate</a> directive is working per request only. In general case, I just need to limit bandwidth from 1 IP, independently how many parallel TCP connections per IP used by client 10 or 100.

пн, 11 нояб. 2019 г. в 20:06, Peter Booth <[hidden email]>:
Why do you want to do this at all? 
What is the real underlying problem that you are attempting to solve?



On Nov 11, 2019, at 8:29 AM, Kostya Velychkovsky <[hidden email]> wrote:

I use Linux, and had a bad experience with Linux shaper (native kernel QoS mechanism - tc ), it consumed a lot of CPU and worked unstable. So I rejected the idea to keep using it. 

пн, 11 нояб. 2019 г. в 15:23, Christos Chatzaras <[hidden email]>:

> On 11 Nov 2019, at 15:09, Kostya Velychkovsky <[hidden email]> wrote:
>
> Hello, is it the correct way to limit download/upload speed per client IP,  at the same time ignore how many connections it opens and request rate produced?
>
> I need just limit bandwidth for example  100 mbit/s per IP, and no matter it opens 1 connection or 100 simulation connections.
>

Maybe it's better to do this with firewall. For example in FreeBSD this can be done with IPFW + Dummynet.
_______________________________________________
nginx mailing list
[hidden email]
http://mailman.nginx.org/mailman/listinfo/nginx


--
Best Regards 

Kostiantyn Velychkovsky 
_______________________________________________
nginx mailing list
[hidden email]
http://mailman.nginx.org/mailman/listinfo/nginx

_______________________________________________
nginx mailing list
[hidden email]
http://mailman.nginx.org/mailman/listinfo/nginx


--
Best Regards 

Kostiantyn Velychkovsky 

_______________________________________________
nginx mailing list
[hidden email]
http://mailman.nginx.org/mailman/listinfo/nginx
Reply | Threaded
Open this post in threaded view
|

Re: Per IP bandwidth limit

J.R.
In reply to this post by Kostya Velychkovsky
Maybe you can write something with the njs module? Nothing that I have
read in the standard nginx docs or blogs really addresses how you want
to throttle (though it does make sense).

Maybe there is a 3rd party module?
_______________________________________________
nginx mailing list
[hidden email]
http://mailman.nginx.org/mailman/listinfo/nginx
Reply | Threaded
Open this post in threaded view
|

Re: Per IP bandwidth limit

Kostya Velychkovsky
Maybe, but I didn’t find something relatively to my question.

Надіслано з iPhone

> 12 лист. 2019 р. о 02:01 J.R. <[hidden email]> пише:
>
> Maybe you can write something with the njs module? Nothing that I have
> read in the standard nginx docs or blogs really addresses how you want
> to throttle (though it does make sense).
>
> Maybe there is a 3rd party module?
> _______________________________________________
> nginx mailing list
> [hidden email]
> http://mailman.nginx.org/mailman/listinfo/nginx
_______________________________________________
nginx mailing list
[hidden email]
http://mailman.nginx.org/mailman/listinfo/nginx
Reply | Threaded
Open this post in threaded view
|

Re: Per IP bandwidth limit

Zafer Gürel
There is something like follows:

It's a lua script and may be a starting point to develop a module for your need. There is a comment like that:
here we use the remote (IP) address as the limiting key
Hope it helps.

Zafer

Kostya Velychkovsky <[hidden email]>, 12 Kas 2019 Sal, 11:51 tarihinde şunu yazdı:
Maybe, but I didn’t find something relatively to my question.

Надіслано з iPhone

> 12 лист. 2019 р. о 02:01 J.R. <[hidden email]> пише:
>
> Maybe you can write something with the njs module? Nothing that I have
> read in the standard nginx docs or blogs really addresses how you want
> to throttle (though it does make sense).
>
> Maybe there is a 3rd party module?
> _______________________________________________
> nginx mailing list
> [hidden email]
> http://mailman.nginx.org/mailman/listinfo/nginx
_______________________________________________
nginx mailing list
[hidden email]
http://mailman.nginx.org/mailman/listinfo/nginx

_______________________________________________
nginx mailing list
[hidden email]
http://mailman.nginx.org/mailman/listinfo/nginx