Описание тега bandwidth-throttling
Bandwidth throttling is the intentional slowing of the speed at which data is sent from the server to a client. In web programming, it is used to lower the chances of a DDOS attack, by the website/app releasing data in a limited speed.
In web programming, Bandwidth throttling is used to intentionally lower the rate at which data is served to the client. It is considered one of the important methods to lower chances of failure of a site from a DDOS attack.
It can also be used to ensure that all users are accessing enough resources by limiting greedy users who may be using lots of connections and downloading lots of data whereby other users are suffering from slower connections.
Php Example
set_time_limit(0);
$file = array();
$file['name'] = "file.mp4";
$file['size'] = filesize($file['name']);
header("Content-Type: application/octet-stream");
header("Content-Description: file transfer");
header('Content-Disposition: attachment; filename="' . $file['name'] . '"');
header('Content-Length: '. $file['size']);
$open = fopen($file['name'], "rb");
while(!feof($open))
{
echo fread($open, 256);
usleep(500);
}
fclose($open);
In the above example, a download manager(which opens lots of connections) think that server is unresponsive and hence close all connections
Links