this post was submitted on 28 Jun 2023
292 points (98.3% liked)

Asklemmy

43970 readers
1067 users here now

A loosely moderated place to ask open-ended questions

Search asklemmy ๐Ÿ”

If your post meets the following criteria, it's welcome here!

  1. Open-ended question
  2. Not offensive: at this point, we do not have the bandwidth to moderate overtly political discussions. Assume best intent and be excellent to each other.
  3. Not regarding using or support for Lemmy: context, see the list of support communities and tools for finding communities below
  4. Not ad nauseam inducing: please make sure it is a question that would be new to most members
  5. An actual topic of discussion

Looking for support?

Looking for a community?

~Icon~ ~by~ ~@Double_A@discuss.tchncs.de~

founded 5 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
[โ€“] Saik0Shinigami@lemmy.saik0.com 56 points 1 year ago (14 children)

I host my own. Specifically for myself and those who are friends or friends of friends.

I have a cluster of servers operating in my garage. Free real-estate for tons of stuff I want to host. I have to "pay" for electricity... the rest was already paid for long ago. My electricity cost for my whole cluster... is an estimated $1750 a year. But that cluster is 160 CPU cores, 750 GB of RAM, and ~400TB of storage. You ain't getting that on a cloud hosted provider for $145 a month. About $110 of that is subsidized by my business operations. I host email, websites, nextcloud, plex, etc... boatloads of stuff.

[โ€“] WoxRocks@lemmy.ml 5 points 1 year ago (1 children)

How does load balancing work across this fediverse.. if at all?

[โ€“] Saik0Shinigami@lemmy.saik0.com 13 points 1 year ago* (last edited 1 year ago) (1 children)

What kind of load balancing are you thinking about/looking for?

If we look at Lemmy in specific...

Jobs that a server performs for users on it's platform:
Login services(are you even you to begin with?)
Session Management (being logged in at multiple places, not mixing you up with other users...)
Subscriptions (what content to even show you... organizing them on the page... etc.)
Ban lists (and applying them to what you're looking at)
Peering with the other platforms

Jobs that a server performs for off platform users: Sending ActivityPub messages to the other user's platform.(effectively the same as "peering with other platforms" from above)

The idea is that the jobs that the server has to do for it's local users is actually a lot more both numerically and in taxing tasks than the jobs that one particular instance has to do to send updates to the federated instances... A lot of the list in the first case is a boatload of SQL queries. The activitypub notification is effectively a broadcast of a relatively simple text that doesn't take much bandwidth.

So let's look at actual cases now that we have some ideas of what instances are doing.

I run a small instance, I have a few users (because I purposefully keep it small). If my users only ever interact with the fediverse through my instance, then other instances don't have to do most of the jobs in the top list. I've taken that load from lemmy.ml or other bigger instances that my users would have ultimately migrated to if they didn't have my server. The tradeoff is that my few users now cost the 1 connection for activitypub notifications.

Lets look at a theoretical "perfect" setup... 2,000,000 users across let's say 1,000 instances. Evenly distributed. So each instance has 2,000 users. In that case, any given server would have to serve 2,000 people from the upper list and 999 activitypub broadcasts. This is significantly easier to do than have a single server try to handle all 2,000,000 users on a single instance serving nothing to the activitypub broadcasts.

There's is one caveat with this... activitypub broadcasts will send everything that is subscribed... even if users don't actually view it. So there could be some waste. This then leads to the discussion of well how many users until there's a breakeven in cost of the first list vs the potential waste of the activitypub bandwidth. That answer is debatable... But most people agree that take the discussion seriously that the return on investment could be as low as 2-5 users. I think that the bandwidth cost outweighs the SQL (CPU, RAM, etc...) costs quite handily personally.

Other useful functions that occurs with this setup... As long as I got the ActivityPub message on my server... my users can see all of Lemmy.ml's content. Regardless of if Lemmy.ml is actually running or not. We saw that with the downtime that some of the bigger servers are seeing, all the other instances could still consume the content... Just no updates were being sent.

This is relatively simplistic... I've skipped some nitty gritty stuff... I've simplified some other stuff. But this is the gist.

Edit: Other functions that you need to think about that lemmy is accomplishing for local instance users... Notifications, saved posts, language filtering, settings, profiles, avatars, reporting, slur filters, moderation, NSFW filters.. The top list is actually considerably larger... like I said we simplified.

[โ€“] d0m@lemmy.world 2 points 1 year ago* (last edited 1 year ago)

Great explanation, thanks for the write up! I have a couple of questions, if I may.

  • So if I setup my own instance tomorrow, it'd be sending notifications of activity to all the other instances? Maybe I'd have to have a list of instances I'd like to notify? How does it discover the other instances?

  • If my instance is listening to all other instances? Won't saving all posts take up a lot of disk space? I guess there is only text and link data and no media, but wouldn't it add up fast as the number of users/instances grow ?

load more comments (12 replies)