Comments (2)
Having looked into this as part of #8, I don't it's practical to implement a bandwidth measurement interface. Because browsers don't send that information to the server, this would have to be calculated on the server using a second HTTP request, using something along the lines of:
- Client pings CDN URL 1
- CDN stores current timestamp, redirects user to CDN URL 2 (appending a unique hash)
- Client pings CDN URL 2
- CDN does a lookup on the hash, calculates the difference between the current timestamp and stored timestamp for that hash, obtaining the time it takes for a round-trip between client and server
- CDN delivers the resource based on the value obtained
The problem with this, apart from the added complexity of tying two HTTP requests together to deliver a single resource (what happens if CDN URL 1 hits a different instance than CDN URL 2?), the value extracted from the routine described above isn't representative of the available bandwidth.
I'm not an expert on TCP by any stretch, but I do know that it has some mechanisms in place precisely because it has no idea about how much bandwidth will be available when a connection is started.
One of those mechanisms, called "slow-start", makes the connection start with a very limited bandwidth, which grows exponentially over time until it detects (using a congestion avoidance mechanism) that it has used all the bandwidth it can.
In practice, this means that the only way to (more or less accurately) predict the bandwidth available for the transfer of a 1.5MB image is to send a dummy 1.5MB image across the wire and measure the bandwidth at peak transfer time, which of course is unpractical.
There were numerous attempts to introduce a browser-level API to provide this information (see this, this and this) without really getting anywhere, one of the reasons precisely being how difficult it is to measure available bandwidth.
My suggestion is that until an API is standardised and browsers are able to calculate and provide this information as part of the request, we park this.
/cc @jimlambie
from cdn.
I agree completely, thank you for the thorough response!
We'll close this one for now. If the future arrives, we can revisit.
from cdn.
Related Issues (20)
- An in-range update of snyk is breaking the build 🚨 HOT 8
- An in-range update of chokidar is breaking the build 🚨 HOT 1
- Incorrect Content-Length when retrieving gzipped data HOT 1
- Update installation instructions in README HOT 4
- An in-range update of chokidar is breaking the build 🚨 HOT 1
- Whitelist domains when using allowFullURL HOT 1
- API fatal error handler returned after process out of memory when load js file which is abot 10M HOT 1
- Fix LGTM Erros & Warnings and Recomandations HOT 1
- changing routes and responses HOT 2
- Cdn cache video out of size
- Add Negative Cache TTL for failing requests
- Connection hangs on If-None-Match 304 response
- devicePixelRatio or dpr? HOT 2
- Multiple S3 but not multi domain
- version nodejs 12.1 HOT 2
- [Question] Is project dead? HOT 5
- error: Error: Cannot find module '/Users/eduardoboucas/Sites/cli/wrapper/updater.js' HOT 18
- search for images in directory without extension (PNG, JPG, etc) HOT 1
- How to remove the background from an image?
- [Question] search images without extension - REPLY?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cdn.