Questions tagged [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

Bandwidth throttling

Work arounds for Bandwidth throttling

135 questions
7
votes
1 answer

How can can I throttle bandwidth on an application domain level in Windows (in user mode)?

I would like to make the following happen: My application runs on a Windows machine (call it application A). I can modify the source code of application A to introduce bandwidth throttling. I would like to be able to reuse my bandwidth throttling…
Alexandru
  • 12,264
  • 17
  • 113
  • 208
7
votes
3 answers

What does option limit in tc netem mean and do?

I'm trying to emulate slow net link with command tc. I use netem to emulate delay and packet loss and htb to emulate narrow bandwidth, but I find there is a limit option in netem, what does this option do? will it affect the final bandwidth? I…
Daniel Dai
  • 1,019
  • 11
  • 24
7
votes
2 answers

Bandwidth throttling using netem?

I am trying to emulate a network as (bitrate: 200kbps , packetloss: 0.03, delay: 400ms) and I am using netem. tc qdisc add dev eth1 root handle 1:0 netem delay 400ms loss 0.03% tc qdisc add dev eth1 parent 1:1 handle 10: tbf rate 200kbit buffer 1600…
confused1
  • 253
  • 1
  • 3
  • 9
6
votes
1 answer

How to simulate slow connection with Javascript?

I've got a request for a research website which will test user's behavior when doing repetitive tasks on a normal and slow Internet connections. I'm wondering if there are any JS libraries I could use for bandwidth throttling in the different…
Goran Stoyanov
  • 2,311
  • 1
  • 21
  • 31
6
votes
2 answers

IIS7 and ASP.NET how to throttle user requests

I am using ASP.NET with IIS7 and today a bug in one of my pages caused the server to go down. The script was using ajax to query a resource at a rate of ~1000 requests per second. The requests are authenticated, so I know what user requested what…
Mohamed Nuur
  • 5,536
  • 6
  • 39
  • 55
5
votes
0 answers

Charles SSL throttle specific path or url

I got Charles working, and I know how to use it. I've done throttling before for the entire domain, but I have a need to throttle a specific path or url. For reference, I can throttle this: https://www.example.com What I want to throttle is:…
TooManyEduardos
  • 4,206
  • 7
  • 35
  • 66
5
votes
3 answers

Limiting upload speed on Java?

I'd like to programmatically limit an upload or download operation in Java. I would assume that all I'd need to do was do check how fast the upload is going and insert Thread.sleep() accordingly like so: while (file.hasMoreLines()) { String line…
Naftuli Kay
  • 87,710
  • 93
  • 269
  • 411
5
votes
1 answer

throttling amazon s3 to limit budget

I am creating a small site and would like to use Amazon's S3 to host and deliver user-uploaded images. However, I'm slightly concerned about bandwidth usage(and the bill) as I've read some horror stories about malicious users sending bills…
edofic
  • 727
  • 8
  • 15
5
votes
2 answers

How do I limit socket speed in C?

Possible Duplicate: How do you throttle the bandwidth of a socket connection in C? I'm writing a simple FTP server in C for a Unix environment. As a feature of the server, I want to limit the upload/download speed of a user. Are there any…
can.
  • 2,098
  • 8
  • 29
  • 42
4
votes
2 answers

yt-dlp 'rate-limit' not throttiling speed in Python script

I have implemented yt-dlp as part of my Python script, it works well, but I am unable to get the rate-limit feature to work. If you run the same command from the CLI the rate is limited correctly, is anyone able to tell me the correct syntax? I have…
crawf
  • 75
  • 6
4
votes
3 answers

Throttle issue with server accessing a Laravel API

I have an API that is using Laravel that is being called from another instance of Laravel with Guzzle. The second server's IP address is triggering the throttle on the API. I would like to pass through the user's domain and IP address from the…
whoacowboy
  • 6,982
  • 6
  • 44
  • 78
4
votes
2 answers

Google Chrome throttling with Selenium

There was a similar question to this a year ago (Network throttling with chrome and selenium), but it looks like the answers to that question are no longer valid as a bug and fix have come out in the last couple months.…
4
votes
1 answer

Why is UDP broadcast clogging router at much lower speeds then TCP?

The idea: We have an imaging system generating about 200-300 Mb/s of data that currently is passed over an ethernet cable to a computer which decompresses them and displays the live image. We are trying to make the system wireless over a LAN by…
branch
  • 41
  • 1
  • 4
4
votes
1 answer

chrome dev-tools network throttling seems slower than setting

When using chrome dev tools, the network throttling functionality seems to simulate a slower connection than the kb/s down setting defines. For example when simulating with the preset of 50kb/s for GPRS and downloading a 256kb file, chrome shows the…
4
votes
0 answers

Limit bandwidth of ports using tc

I am trying to limit the maximum bandwidth for a range of ports (collectively) using tc. Below is the script: tc qdisc add dev eth0 root handle 1: htb default 10; tc class add dev eth0 parent 1: classid 1:1 htb rate 75kbit; tc qdisc add dev eth0…
John Elaine
  • 359
  • 5
  • 22
1
2
3
8 9