# Throttling uploads (incoming) traffic to nginx

**URL:** <https://www.ruby-forum.com/t/throttling-uploads-incoming-traffic-to-nginx/157558>\
**Category:** NGINX\
**Created:** [January 13, 2009, 4:44am UTC](https://www.ruby-forum.com/t/throttling-uploads-incoming-traffic-to-nginx/157558 "2009-01-13T04:44:30Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jkadarusman](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/d9b06d/32.png) [@jkadarusman](https://www.ruby-forum.com/u/jkadarusman)\
**Post date:** [January 13, 2009, 4:44am UTC](https://www.ruby-forum.com/t/throttling-uploads-incoming-traffic-to-nginx/157558/1 "2009-01-13T04:44:30Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![jkadarusman](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/d9b06d/32.png) [@jkadarusman](https://www.ruby-forum.com/u/jkadarusman)\
**Post date:** [January 14, 2009, 3:31am UTC](https://www.ruby-forum.com/t/throttling-uploads-incoming-traffic-to-nginx/157558/2 "2009-01-14T03:31:37Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![jkadarusman](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/d9b06d/32.png) [@jkadarusman](https://www.ruby-forum.com/u/jkadarusman)\
**Post date:** [January 14, 2009, 3:19pm UTC](https://www.ruby-forum.com/t/throttling-uploads-incoming-traffic-to-nginx/157558/3 "2009-01-14T15:19:16Z")

</div>

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 K. \<

---

<div class="post-metadata">

**Author:** ![jkadarusman](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/d9b06d/32.png) [@jkadarusman](https://www.ruby-forum.com/u/jkadarusman)\
**Post date:** [January 25, 2009, 8:55pm UTC](https://www.ruby-forum.com/t/throttling-uploads-incoming-traffic-to-nginx/157558/4 "2009-01-25T20:55:55Z")

</div>

Hi!

Patch in attachment for upload module 2.0.8 introduces directive  
upload\_limit\_rate 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 S…
