Login   Register  
PHP Classes
elePHPant
Icontem

QoS Bandwidth Throttle in PHP

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us

  Author  
Picture of Artur Graniszewski
Name: Artur Graniszewski is available for providing paid consulting. Contact Artur Graniszewski .
Packages: 13 Browse all classes by Artur Graniszewski Browse all classes by
Country: Poland Poland - PHP jobs in Poland
Age: 31
All time rank: 39210 in Poland Poland
Week rank: 59 Up2 in Poland Poland Up
Innovation award
Innovation award
Nominee: 7x

Winner: 1x


  Detailed description   Download .zip .tar.gz  
This class can be used to limit (throttle) the speed of files served for download.

It intercepts the PHP script output by setting a buffering handler that is called every time a given number of bytes are served to the browser.

The class measures the time since the last time the PHP output buffer was flushed and hold on PHP for a while if the average download speed is above a given limit.

---------------------------------------------------------------------------
There are three different bandwidth shaping mechanisms to ensure adequate Quality of Service:

1) burst transfer rate will be switched off after sending X bytes to the user (this can be helpful to send small images quickly, and limit the download speed of huge files)

2) burst transfer rate will be switched off after given period of time in seconds, then it will revert to the standard throttle speed

3) burst transfer rate will not be activated at all, the download speed limit will be constant during the whole downloading process (in this case $config->burstLimit must be equal to the $config->rateLimit)

  Classes of Artur Graniszewski  >  QoS Bandwidth Throttle in PHP  >  Download .zip .tar.gz  >  Support forum Support forum (2)  >  Blog Blog  >  RSS 1.0 feed RSS 2.0 feed Latest changes  
Name: QoS Bandwidth Throttle in PHP
Base name: bandwidth-throttler
Description: Limit the speed of files served for download
Version: 1.1.5
PHP version: 5.2.0
License: GNU Lesser General Public License (LGPL)
All time users: 1347 users
All time rank: 2519
Week users: 5 users
Week rank: 541 Up
 
  Groups   Screenshots Screenshots   Rate classes User ratings  
  Applications   Related links   Files Files  

  Groups  
Group folder image HTTP HTTP protocol clients, headers and cookies View top rated classes
Group folder image PHP 5 Classes using PHP 5 specific features View top rated classes
Group folder image Files and Folders Listing, accessing and manipulating files and folders View top rated classes
Group folder image Systems administration System configuration and management View top rated classes
Group folder image Performance and optimization Tools to measure and optimize the performance of systems View top rated classes

  Files folder image Screenshots  
Bandwidth throttling in practice
File Role Description
Accessible without login Image file speed_decrease.PNG Screen Bandwidth throttling in practice


  Innovation Award  
PHP Programming Innovation award nominee
January 2011
Number 2

Prize: One copy of DWebPro Standard License
If too many users access a server to download files or other resources, the server may reach to the bandwidth usage limit and the access to the server may become too slow to all users.

A solution for this problem consists in throttling the download speed, i.e., limiting the speed by which the files are served to the users that are downloading them.

This class implements a clever download speed throttling approach controlled by PHP.

It consists in capturing the output of the download scripts into a buffer, flush the buffer at a rate that does not exceed a given limit by introducing eventual pauses if the file is served at a speed above the limit.

Manuel Lemos

  User ratings  
Ratings
Utility
Consistency
Documentation
Examples
Tests
Videos
Overall
Rank
All time:
Good (95.0%)
Good (95.0%)
-
Good (90.0%)
-
-
Sufficient (66.0%)
409
Month:
Not yet rated by the users

  Applications that use this class  
No application links were specified for this class.
Add link image If you know an application of this package, send a message to the author to add a link here.

  Related links  
Link Description
Bandwidth throttling [Definition] Definition of the bandwidth throttling on Wikipedia
Rate limiting [Definition] Definition on Wikipedia
Project homepage Project homepage (polish version)

  Files folder image Files  
File Role Description
Plain text file throttler.php Class Main class
Accessible without login Plain text file example.php Example Example script
Accessible without login Plain text file example2.php Example Example script using data size as the bandwidth limit factor
Accessible without login Plain text file license.txt Lic. LPGP license
Accessible without login Plain text file readme.txt Doc. Documentation

Download all files: bandwidth-throttler.tar.gz bandwidth-throttler.zip
NOTICE: if you are using a download manager program like 'GetRight', please Login before trying to download this archive.