Docs TrafficShaping » History » Revision 9

Revision 8 (moo, 2007-07-07 15:30) → Revision 9/14 (zkv, 2008-11-21 23:12)

h1. [[TracNav(DocsToc)]] 


 Traffic Shaping 

 {{>toc}} ------------ 
 Module: core 

 *Module: core* .. meta:: 
   :keywords: lighttpd, bandwidth limit, traffic shaping 

 h2. .. contents:: Table of Contents 


 Starting with 1.3.8, lighttpd supports limiting the bandwidth for 
 a single connection or config context like a virtual host or a URL. 

 h2. Options 

 Limit connection.kbytes-per-second: 
   limit the throughput for each single connection to the given 
   limit in kbyte/s 

   default: 0 (no limit) 

 Limit server.kbytes-per-second: 
   limit the throughput for all connections to the given limit 
   in kbyte/s 
 Default: 0 (no limit) 


   if you want to specify a limit for a special virtual server 

 <pre> :: 

     $HTTP["host"] == "" { 
       server.kbytes-per-second = 128 



   which will override the default for this host. 

   default: 0 (no limit) 

 *Note:* Additional Notes 

 Keep in mind that a limit below 32kb/s might actually limit the traffic to 32kb/s.  
 is caused by the size of the TCP send buffer. 


 Selective traffic shaping plugin(>=1.5-svn) (>=1.5-svn) 

 There is a small plugin to use selective traffic shaping on a per-connection base. You can e.g. use php and do: 

 <pre> do:: 

  header("X-LIGHTTPD-KBytes-per-second: 50"); 
  header("X-Sendfile: /path/to/file"); 


 to set the speed of the current connection. 

 h2. Plugin options 

 *speed.just-copy-header Options 
 speed.just-copy-header = "enable"* 
 Use "enable" 
   use this on the frontend to just copy the header from the response to the request header (forward it to the backend) 

   default: "disabled" (just use it) 

 *speed.use-request speed.use-request = "enable"* 
 Use "enable" 
   use this on the backend to fetch the speed from the request. This is not useful on the frontend, i think :)  
   default: "disabled" (don't look in the request headers) 


 Download here: