Throttling uploads (incoming) traffic to nginx...

Valery Kholodkov valery+nginxen at grid.net.ru
Sun Jan 25 22:41:52 MSK 2009


Hi!

Patch in attachment for upload module 2.0.8 introduces directive 
upload_limit_rate <speed> and implements upload rate limiting.

Currently I'm in real doubts whether to include it in 2.0.9 or not, 
since I'm working on input filter chain for nginx and implementing rate 
limits in it will cover larger set of problems.

Example configuration:

location = /upload {
     upload_pass @a;

     [...]

     # Limit upload rate to 256k per sec
     upload_limit_rate 256k;
}

The implementation is based on the output rate limiting code, which is 
credited to Igor Sysoev.

Jason Kim wrote:
> I think it's important, because on gigabat LAN, if you upload a large 
> file the server file system goes up way high and is impractical. File 
> system writes are much more severe on performance than writes.
>  
> Also for users on high speed internet we've seen uploads of up to 8 
> Megabytes/sec which causes massive file system load, and noticably slow 
> down the whole server.
> Lastly it would be helpful to block massive DOS attacks that upload 
> large files and cause file system load which our organization has actual 
> have happen.
>  
> Thanks,
> Have a nice day.
> On Tue, Jan 13, 2009 at 6:15 PM, Valery Kholodkov 
> <valery+nginxen at grid.net.ru <mailto:valery%2Bnginxen at grid.net.ru>> wrote:
> 
> 
>     No, currently it's impossible with upload module. And I guess
>     without as well.
> 
>     Does it really sound like a big problem? If it is reasonable, I'll
>     include it into my TODO list.
> 
>     ----- "Jason Kim" <highclass99 at gmail.com
>     <mailto:highclass99 at gmail.com>> wrote:
> 
>      > I asked a similar question but no one answered and we keep failing
>      > when
>      > trying too, so I'm trying to ask again.
>      >
>      > Our organization is testing nginx,
>      >
>      > We noticed that the limit_rate directive works for data sent out from
>      > the
>      > server very well (downloads),
>      >
>      > But absolutely no limit seems to be set for the data sent into the
>      > server
>      > (uploads),
>      >
>      > Is there any way to allow a limit_rate for uploads too? And if not,
>      > would
>      > this be considered a bug to be fixed?
>      >
>      > We handle large uploads, and Upload Module seems perfect, but the
>      > uploads go
>      > at 100% full speed which we want too slow down due to server
>      > load/file
>      > system load.
>      >
>      > Thanks.
> 
>     --
>     Regards,
>     Valery Kholodkov
> 
> 


-- 
Regards,
Valery Kholodkov
-------------- next part --------------
A non-text attachment was scrubbed...
Name: upload_limit_rate.patch
Type: text/x-patch
Size: 6681 bytes
Desc: not available
URL: <http://nginx.org/pipermail/nginx/attachments/20090125/da99317c/attachment.bin>


More information about the nginx mailing list