I’ve been on Lemmy for some time now and it’s time for me to finally understand how Federation works. I have general idea and I have accounts on three federated instances, but I need some details.

Let Alpha, Beta, Gamma and Delta be four federated instances. I have an account on Alpha and create a post in a community on Beta. A persoson from Gamma comments on it and a person from Delta upvotes the post and the comment.

The question: On which instances are the post, the comment and the upvotes stored?

  • kopper [they/them]@lemmy.blahaj.zone
    link
    fedilink
    English
    arrow-up
    11
    ·
    edit-2
    1 year ago

    All of them. If you can see it from an instance, it’s stored in that instance.

    The only exception are images which may or may not be stored depending on the exact backend software and configuration.

    Both “alpha” and “beta” has authority to hide the post (one hosts your account and the other hosts the community) from the rest of the federation. Similarly, both “beta” and “gamma” have the authority to hide the comment from the federation. That said, instances can also individually hide/purge stuff from their own views without affecting the wider federation if they so choose (which is how things like .world’s blocking of piracy communities work)

    “beta” handles distribution/“boosting” (in masto speak) of the post and comment to other instances (however “gamma” will send it to both “alpha” and “beta” as it’s a reply to “alpha”). AFAIK “alpha” and “gamma” handle the boosting of the upvotes they receive from “delta” (though I could be wrong on that part).

    Oh, and “boosting” doesn’t mean “i got 1 new upvote on this comment :3” it means “delta has sent me this exact Like event owned by person@delta associated to comment@gamma (and a lot of other data)”. There are also keys and signatures involved to make things a bit harder to spoof.

  • s4if@lemmy.my.id
    link
    fedilink
    English
    arrow-up
    2
    ·
    1 year ago

    On all instances. Each instance has copy of what happened and every action is relayed by community instance (in this case, Beta) to all subscriber of the community.

  • Ducks@ducks.dev
    link
    fedilink
    English
    arrow-up
    3
    ·
    1 year ago

    Both. The text data is in the database of all instances that are federated. Your account credentials are only stored on the instance you’re registered to.

  • Rottcodd@kbin.social
    link
    fedilink
    arrow-up
    9
    ·
    1 year ago

    As already noted, on all of them.

    The easy way to grasp how it works:

    When you, on instance.alpha, view a community on instance.beta, you aren’t actually on community@instance.beta. You’re actually on an entirely separate copy - community@instance.beta@instance.alpha. That’s the community you’re reading and posting to and upvoting/downvoting in. Meanwhile, people on other instances are each on their own locally hosted copies of the same community.

    The lemmy software (or kbin or mastodon or whatever) then periodically syncs up all the local copies of community@instance.beta, so you all end up looking at (more or less) the same content, even though it’s actually a bunch of technically separate communities.

      • Rottcodd@kbin.social
        link
        fedilink
        arrow-up
        4
        ·
        1 year ago

        It’s less efficient than a centralized forum would be, but efficiency isn’t the only or even the highest priority. Decentralization is the explicit point of the fediverse, and to the degree that that requires sacrificing some measure of efficiency, that’s just the way it goes.

        The goal was to build a system that would be robust and relatively seamless while remaining decentralized. That’s more or less what they’ve done. There’s a fair amount of fine tuning and tweaking left to be done, and actively being done, but the basic system is what it is because it best balances all of the goals.

          • kopper [they/them]@lemmy.blahaj.zone
            link
            fedilink
            English
            arrow-up
            0
            ·
            1 year ago

            As long as 1 person from an instance is subscribed to a community, that person’s instance will fetch everything that happens inside that community (and keep storing it even if they later unsubscribe, unless manually purged by an instance admin)

      • Falmarri@lemmy.world
        link
        fedilink
        English
        arrow-up
        4
        ·
        1 year ago

        It depends what you mean by inefficient. It’s very efficient if you’re optimizing for robustness and control of data.

  • strepto@kbin.social
    link
    fedilink
    arrow-up
    1
    ·
    1 year ago

    It’s stored on all 4.

    Regardless of which on you create the content on, assuming they all federated with each other correctly, every instance hosts its own copy of your posts.