How does my IPFS hosted website stack up against my static site

Last year I spun up a new VPS and deployed my own IPFS node with an HTTP gateway. I used DNSLink to map the domain name paranoidpengu.in to the latest version of my website hosted on IPFS. The performance was seemingly impressive when serving content from the local repository, but how would it compare to serving static content.

DNSLink

IPFS using DNSLink to resolve paranoidpengu.in natively

To be able to perform a (somewhat) reliable comparison, I decided to set up hugo.paranoidpengu.in as a new virtual host under Nginx, on the same instance that is hosting my IPFS node. The virtual site configuration will be identical for both sites, with the exemption of the gateway using a reverse proxy to fetch content from the local repository. The static site will host the same content that is currently pinned on my IPFS node.

Paranoidpengu.in configuration

This is how DNSLink has been set up to map paranoidpengu.in to an IPFS hash (notice the use of IPNS):

# DNS TXT record
dig +short _dnslink.paranoidpengu.in txt
"dnslink=/ipns/k51qzi5uqu5dheyl2zgg9yjh4ybr772j2d109agukemqx3bant1020127zgibk"

The following configuration is based on documentation from ipfs.io’s public git repositories. Nginx proxies requests to the IPFS daemon who resolves the DNSLink and returns the addressed content.

# NGINX configuration
server_name paranoidpengu.in;
...
proxy_pass_header Server;
proxy_read_timeout 1800s;
...
location / {
    limit_except GET {
        deny  all;
    }

    proxy_pass http://127.0.0.1:8080;
    proxy_set_header Host $host;
    proxy_cache_bypass $http_upgrade;
}
...

Hugo.paranoidpengu.in configuration

Nothing special here, just a standard host configuration fetching static files from a directory.

# NGINX configuration
server_name hugo.paranoidpengu.in;
...
location / {

    limit_except GET {
        deny  all;
    }

    try_files $uri $uri/ =404;
}
...

Meet the server

The server responsible for hosting the websites is a Scaleway Stardust instance. It has less than stellar specifications, but it only cost €0.0025/hour, and it has done a fair job of hosting my IPFS node.

# Server specifications
1 vCPU
1 GB RAM
10 GB of local storage
100 Mbps Bandwidth

OS Ubuntu 20.04
IPFS version 0.10.0

Let’s get ready to rumble

How much of beating will the static website be able to inflict on the IPFS hosted one? Realistically, I would not expect this to be much of a close fight at all. To see how each website performs, I will let WebPageTest give them a run for their money.

WebPageTest - paranoidpengu.in (IPFS)

URL for performance test:
https://paranoidpengu.in/2020/12/paranoidpenguin-goes-decentralized-with-ipfs/
Location: Paris

IPFS hosted website performance test

Performance results (Median Run - SpeedIndex) courtesy of WebPageTest.

The result was pretty pretty good in my humble opinion. The page was fully loaded in 0.573 seconds with 7 requests, and the total page size was 83KB. If I had not already known, I would never have suspected that this website had been fetched from IPFS.

WebPageTest - hugo.paranoidpengu.in (static)

URL for performance test:
https://hugo.paranoidpengu.in/2020/12/paranoidpenguin-goes-decentralized-with-ipfs/
Location: Paris

static hosted website performance test

Performance results (Median Run - SpeedIndex) courtesy of WebPageTest.

As expected, the static website took the win, but it was unexpectedly close. It edged out the IPFS hosted competition with a measly 72 milliseconds. The page was fully loaded in 0.501 seconds with 7 requests, and the total page size was 83KB.

The aftermath

I tried a few different services to analyze the performance of the two websites, but I am particularly fond of WebPageTest. However, both GTmetrix, Pingdom, and web.dev (Google Lighthouse) gave comparable results. Anyhow, this is by no means any kind of scientific research, I just wanted to scratch an itch.

If you want to host your website on IPFS, then I would recommend setting up a cheap VPS to host your node. Far better than relaying on Cloudflare or similar providers. I am sure Cloudflare does a good job with their IPFS Gateway, but come on now, how does that help with decentralization?

Speaking of Cloudflare, if you want to experience the difference in speed between a local IPFS node with pinned content, and a remote one, then feel free to browse cloudflare-ipfs.com/ipns/paranoidpengu.in after they run their garbage collector ;-)