Hi, I wanted to host a personal Lemmy instance online (for just myself, I don’t think I can take the upkeep for other users - please let me know if this is not possible) and wanted to understand how to “attach” a CDN service to it.

The idea behind doing this is that I’m in the US but I’m looking to host a server in Europe. I am looking into Cloudflare’s free CDN service, but it would be great if someone could point me towards how I can configure this setup to speed up the loading time for my Lemmy instance (which is going to be far away from me, geographically).

I would also like to know about your setups and how you have hosted Lemmy.

Thanks!

  • Perhyte
    link
    English
    2
    edit-2
    1 year ago

    Using Cloudflare nameservers helps to proxy your traffic because if proxying is enabled (“orange cloud”) those servers aren’t handing out your IP address to people who request your domain, they’re handing out addresses belonging to Cloudflare machines near the visitor instead. They have machines in data centers all around the world, and they would like the traffic to end up in the data center closest to where it’s needed.

    Doing that means they can do stuff like reduce cross-region network traffic: for instance, if your VPS is in Europe but a bunch of visitors from the US suddenly request a certain image on your site (because you’ve just posted to a popular community, perhaps), they only need to have that image data cross the Atlantic once before they can serve it up many times in the US. Besides saving bandwidth that also allows it to be served faster to most visitors, because most requests for it are effectively served from a local data center instead of from one on another continent. They’ll also continue to be able to serve your image even when your VPS is down for whatever reason, as long as it’s already in cache.

    Theoretically they could probably do all of that using CNAME records instead, I don’t know why they don’t. Maybe there’s some technical reason or maybe they just prefer this slightly simpler setup. I suppose it would add an extra DNS roundtrip, but that wouldn’t really be noticeable to most users.

    (Most of that is probably oversimplified and but hopefully that clarifies it a bit)