'A Weekend With IPFS' by Will Hill

This post gives a very good command-by-command tutorial on setting up IPFS and using it to host a website (using a DNS link that points to an IPNS hash, of course) https://medium.com/@bkawk/a-weekend-with-ipfs-9f2647fc231. Check it out!

There’s also an IPFS vs. HTTP2 benchmark, though the analysis of the results is partially predicated on the idea that “Adding a file places it on many machines that are part of the connected swarm.” (stated in the intro). Note that this is not true right now, and most of the incentives (Filecoin, a more sophisticated Bitswap implementation, etc.) that might make this true this are not in play right now.

6 Likes

He could have pointed DNS to his own gateway rather than the official one.

Other than that I’m curious if nginx caching makes much different vs. something already cached by the ipfs node (enough difference to justify enabling it).

The IPFS node out of the box doesn’t cache items in the browser for any length of time, getting the item from a local cache has to be faster than making a full http request.
I also prefer having nginx between the public internet and any service as it allows me to quickly control access if I should need to.

The IPFS node out of the box doesn’t cache items in the browser for any length of time, getting the item from a local cache has to be faster than making a full http request.

That’s not exactly accurate. Gateways set an ETag header and for some types of content they also set Cache-Control:public, max-age=29030400, immutable. When loading an ipfs site twice, I get etag-304 and local cache hits.

I also prefer having nginx between the public internet and any service as it allows me to quickly control access if I should need to.

Sure, I was just wondering how big the difference is between nginx cache vs no-nginx-cache for items that are pinned or locally cached by the ipfs daemon behind it. If the difference is large, it would mean ipfs might be slow retrieving content from its own datastore in comparison to an static disk cache (it will probably be slower, but how much?). Otherwise, having a proxy caching layer may not be necessary or cost-effective.

You say that nginx caching fixes the slowness of the official gateway, but the comparison is a bit unfair, since you are testing a very busy load-balanced node with lots of content with your own clean box.

The HTTP2 site is caching, so the second page reload takes just 134 milliseconds whereas the IPFS site still takes 2 seconds.

The 2 seconds of difference (which is a lot and surprises me too) may be a result of available bandwitdth, disk speed, ipns name resolution (which I think would happen locally and very fast for your own node), or other parts of the nginx configuration (gzip). I wonder if you are comparing a fresh non-cached retrieval from public gateway vs. a locally cached one response from mem-cache.

In any case, other than proxy caching there are many differences between your node and the public gateway that should be taken into account when making speed comparisons between the two.

By the way, official gateways also have Nginx doing reverse proxying in front of the ipfs gateway. So it’s not a test of “IPFS vs HTTP2” (in fact that comparison is very weird), but rather nginxA+ipfs vs nginxB+ipfs.

That all said, thanks for the tutorial. It’s very illustrative on how to setup a box with an ipfs an strengthen the network.

You are right the tests were a quick and dirty finger in the air at best. The issue I was solving with nginx is that I wanted files to be served from the local browser cache on the second and subsequent requests, at the time of writing which was a few months before I published it, I wasnt getting any browser caching witohut nginx, every request was being resolved from the ipfs gateway. If i get some more play time ill set up a side by side test and share the results

at the time of writing which was a few months before I published it

ah, it’s very possible that this was something fixed in the meantime then…

How? Is there a guide to accomplish this, without using the official ipfs.io site/gateway.

1 Like

Would something like this be what I am after?

Yeah that looks like it