xuset / planktos

Serving websites over bittorrent
https://xuset.github.io/planktos/
MIT License
538 stars 19 forks source link

Reduce the number of http requests for an update #47

Open xuset opened 7 years ago

xuset commented 7 years ago

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

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

georgeaf99 commented 7 years ago

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

georgeaf99 commented 7 years ago

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

xuset commented 7 years ago

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.