Git Product home page Git Product logo

Comments (2)

eduardoboucas avatar eduardoboucas commented on August 24, 2024 1

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:

  1. Client pings CDN URL 1
  2. CDN stores current timestamp, redirects user to CDN URL 2 (appending a unique hash)
  3. Client pings CDN URL 2
  4. 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
  5. 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.

jimlambie avatar jimlambie commented on August 24, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.