# Patch limit\_rate\_max: for your review

**URL:** <https://www.ruby-forum.com/t/patch-limit-rate-max-for-your-review/224000>\
**Category:** NGINX\
**Created:** [October 26, 2012, 9:14am UTC](https://www.ruby-forum.com/t/patch-limit-rate-max-for-your-review/224000 "2012-10-26T09:14:06Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![aris](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/258eb7/32.png) [@aris](https://www.ruby-forum.com/u/aris)\
**Post date:** [October 26, 2012, 9:14am UTC](https://www.ruby-forum.com/t/patch-limit-rate-max-for-your-review/224000/1 "2012-10-26T09:14:06Z")

</div>

Hello

I have a new patch for Nginx. I use this server to stream videos. I  
needed  
a way to burst the rate with limit\_rate\_after but controlled from  
config,  
not at full throttle. Eg.: send 4Mb with 500KBps and the remaining with  
90KBps.

This is useful when sending mp4 that have a 2 to 6MB of index data at  
the  
beginning of the file and playback only starts after this is received.  
This  
way I can start the video playback faster not after 20 seconds or so.  
However, if you have 500 new users per seconds you can choke the  
bandwidth  
so the need to control the burst speed.

I created a new config directive limit\_rate\_max that applies to initial  
burst speed.  
Another change I made is to put the limit\_rate\_after in server  
variables.  
I need this to control the burst quantity on the fly based on url param.

if ($arg\_burst){  
set $limit\_rate\_after $arg\_burst;  
}

The index for each file is different and with this I control how much  
burst  
we need, useful when users seek a lot and index is recalculated on seek  
for  
each file…

If anyone can review this and find it useful, let me know, it works for  
my  
needs.

I thank to Andrei (Latzease) for his contribution to this… he made it  
happen.
