planktos icon indicating copy to clipboard operation
planktos copied to clipboard

Reduce the number of http requests for an update

Open xuset opened this issue 8 years ago • 3 comments
trafficstars

When update() is called, it makes 4 http requests which makes calling update() frequently infeasible. The files requested everytime update() is called:

  • planktos/root.torrent
  • planktos/manifest.json
  • planktos/install.js
  • planktos/planktos.min.js

It is better to only request planktos/root.torrent initially, and if the torrent is new then request the remaining files.

xuset avatar Feb 12 '17 20:02 xuset

This will at least double the latency of the page load, since the network calls will have to be sequential.

georgeaf99 avatar Feb 12 '17 22:02 georgeaf99

I don't think we should make the optimization decision here unless it is transparent to the user

georgeaf99 avatar Feb 12 '17 22:02 georgeaf99

As of now, update() does not delay the page load time.

While update() will take longer with the optimization when an update is found because the requests are sequential, it will on average take less time due to the fact that updates to a website are likely to be more infrequent then the calls to update(). When no updates are found, the most frequent case, update() takes less time.

Not only that, browsers limit the number of concurrent http requests to about ~8 so initiating 4 http requests every time update() is called cuts in half the available pool of requests which can cause page loads to take even longer.

xuset avatar Feb 12 '17 22:02 xuset