Hacker News new | ask | show | jobs
by AndrejM 5862 days ago
The only thing I don't understand about github is that "hardcore archiving in process..". I mean why do I have to wait a minute before I can start downloading the archive? Isn't it costly if the server has to create an archive every time someone requests a download?
4 comments

Archives are generated when they are requested and cached for fifteen minutes. This cache length results in an average of 3.5GB of cached archives on disk at any given time. We have to serve a large number of archives for arbitrary revisions, so making you wait a few seconds for a tarball is currently the best tradeoff. It's possible that in the future we will increase the cache TTL (and the size of the cache) so that you are more likely to hit an already generated archive.
That explains it. Thanks! (and I won't complain anymore :p)
It's because the server has to create a tarball on demand, which can take a while.

So, instead of having your web request unresponsive for a minute while it's processing, they queue up a background task on the server and give you a "hardcore archiving in process.." response immediately.

Then I imagine they do some ajax polling to check when the background task has finished and the archive is ready.

It's a really good technique if you want your web app to be responsive. We do it at work for basically anything that will take more than a second.

The result is probably cached, but for a HEAD you more than likely won't have more than one or two requests for a tarball.
What do you think happens most, pushing changes or downloading a tarball?