Is There Any Option To Limit Download Speed In Xsendfile ? I want to Make Speed Limit & Connection Limit By Xsendfile
Before Xsendfile In Force Download ( fread() ) I make speed limit by this code :
if ($speed > 0 && ($this->bandwidth > $speed*$packet*1024))
{
sleep(1);
$packet++;
}
but in Xsendfile I cant Control Speed In This Way !
Also I was able to active or deactive resume by Accept-Ranges header , but i cant do that in xsendfile to !
X-Sendfile offloads the data transmission to the Linux kernel, which sends data from the file directly to the network. This avoids having to copy the data of the file into userspace memory, and therefore uses less CPU. As the data does not pass through any user space process, there's no way to throttle it manually.
You can limit the bandwidth with traffic shaping, but that's a system configuration question and therefore off-topic here. There are many questions on serverfault on this, e.g. https://serverfault.com/questions/174010/limit-network-bandwith-for-an-ip https://serverfault.com/questions/191560/how-can-i-do-traffic-shaping-in-linux-by-ip
As for file ranges, mod_xsendfile supposedly already takes care of that (see under "Benefits").