4 ms·
So to view your personal website, on my phone, I need to clone an entire Git repo, with the entire history of the entire site.. Some people just treat some tec
by stephenr 12y ago
So to view your personal website, on my phone, I need to clone an entire Git repo, with the entire history of the entire site..
Some people just treat some technologies as a "this can fix anything" when really they're well suited to one task.
This is the sort of thinking that suggests using a Git based solution to sync binary files between computers - the thing even the biggest Git fanboy will admit it does poorly - handling of binary files - and someone wants to use it for that specific purpose.
- kragen 12y agoYou could make a shallow clone with just the objects you need for the front page. If we're taking Git literally here, you need to get the current head somehow, then fetch the commit object, then fetch the root directory object it points to, then fetch the index.html blob object it points to. If we're not using HTTP URLs to name the objects, and the objects in question are small, it would be pretty easy to configure the server to "optimistically" bundle the commit, the directory, and the blob into the response to the request for the head, so it could be a single RTT. It might actually be more efficient to do a single-version shallow clone than to fetch all the relevant assets with separate HTTP requests. Git already supports shallow clones, and you can already use them to clone things like Github wikis, and now you can even push from them: https://stackoverflow.com/questions/6941889/is-git-clone-depth-1-shallow-clone-more-useful-than-it-makes-out https://stackoverflow.com/questions/6941889/is-git-clone-dep.... A --depth 1 clone of https://github.com/kragen/500lines https://github.com/kragen/500lines is 7 megabytes, although the full history is only barely larger. My phone has 400+ megabytes of RAM. More promisingly, though, Git blobs are identified by their hashes. That means that if both my home page and your home page use Twitter Bootstrap 2.3.2, your phone only needs to download it once to render both home pages, since it can see from the blob IDs in the Git directory that it already has the relevant blobs. (Assuming it hasn't been optimistically included in the initial message response!) It doesn't have to worry that one of us might be serving up a maliciously-backdoored version in order to steal users' login cookies on the other's site. By the same token, you can accept the blobs from anyone who has a copy, who might be closer to you on the network than the origin server. Especially if, like me, you're in Argentina with a 250ms ping time to the US. (This assumes you're using something cleverer than the standard git clone protocol, which builds a thin pack including all the objects you lack.) So git-cloning websites to view them could actually be faster than loading them over HTTP the way we do it now, because it eliminates a lot of the unnecessary security issues that we work around with bandwidth duplication and high latency.
- stephenr 12y agoYou're kinda proving my point for me there. The only upside you actually identified there, is a reduced number of requests, which is already possible by using HTTP Keep Alive and HTTP Pipelining.
- kragen 12y agoI was just explaining why the downsides you were writing about weren't serious. I didn't devote much effort to explaining the upside. I guess that a lot of things that seem obvious to me aren't obvious to you, probably because you haven't spent much time thinking about them. I'll try to do better: 1. You can use 10MB of widely-used JavaScript and stock icons on your web page, and the browser will be able to see the page after downloading 100K instead of 10MB. HTTP keepalive and pipelining don't help at all with that. 2. There are no more broken links, so people can link to stuff that isn't hosted on their own server without fear that it will go away next year, or be redirected to more commercially remunerative content, such as linkspam. (This is conditional on them caching a copy on their own server, of course.) HTTP keepalive and pipelining don't help at all with that. 3. Resources can be cached close to you on the network without you having to trust the cache not to feed you corrupted versions of them. (You do have to trust the cache to not report you to the feds for reading an article about how to download Interstellar.) This makes a huge difference in page load time by reducing latency. Again, while HTTP keepalive and pipelining can reduce the multiple of latency, they can't reduce the latency below 2×RTT to the origin server, and practically speaking they're limited to several times that. This is especially important if you're trying to host your personal pages on a high-latency residential internet connection, and/or browsing from a high-latency country. 4. Making every website not just archivable but also forkable enables a new kind of lightweight collaboration. Well, not totally new — I mean, we're doing it now on GitHub and, in a different form, on Wikipedia. 5. Naming web pages by hash rather than by IP address or by a DNS name that maps to an IP address makes it easy to host them on dynamic IP addresses, including with transparent failover when one of them goes down for a while.
- stephenr 12y agoCDN's already solve #1 and #3 #2 is no different than mirroring content, e.g. how fireballed.org works, but over longer time. #4 collaboration is about working on something together. Every visitor to your site is unlikely to need/want/care about collaborating on it. #5 You're suggesting an SHA1 hash is easier to remember than a domain name? Seriously?
- ihnorton 12y agoNot necessarily git - see IPFS http://ipfs.io/ http://ipfs.io/
- amirmc 12y agoWhile Git itself might not be the right thing, the principles behind it may well be. You might like to check out Irmin, a library to build distributed storage systems. http://openmirage.org/blog/introducing-irmin http://openmirage.org/blog/introducing-irmin