• @savjee
    link
    English
    5
    edit-2
    1 year ago

    And a followup question: wouldn’t it be more efficient for big instances to use WebSockets to federate? Making a HTTP request for every action your users take seems unnecessarily wasteful.

    • @[email protected]OP
      link
      fedilink
      English
      31 year ago

      Yeah it’s definitely very busy in terms of the amount of requests that’s get made. I’m not handling a bunch of them that I don’t need but there’s shitloads all the time.

    • RandomBit
      link
      fedilink
      English
      31 year ago

      I think that would only work when the number of instances is small. Two solutions to this might be:

      • have instances act like relays where the home instance of a community notifies 10 instances and then each of those instances notifies 10 instances, etc.
      • batch updates on a timer such that once a minute all posts, comments, boosts, etc within a minutes are buffered and sent together.
      • @savjee
        link
        English
        11 year ago

        I looked at how many WebSocket connections a single server could keep open, and it seems quite high: https://unetworkingab.medium.com/millions-of-active-websockets-with-node-js-7dc575746a01

        That being said, I do agree with you that it’s inefficient to open a connection to every other instance.

        About your proposals:

        • I don’t think your first solution is feasible. How would an instance know which other 10 instances to notify?
        • I do like your idea of batching operations together! Would definitely cut back on the amount of HTTP calls and signature validations. Perhaps this can even be extended further: right now every user interaction is signed before its been sent to other instances. Would be interesting if the instance itself also has a public/private key and that it can sign a whole batch at once (rather then signing every single user interaction).