Web developer. Lead developer of PieFed

  • 53 Posts
  • 1.1K Comments
Joined 3 年前
cake
Cake day: 2024年1月4日

help-circle




  • I’m not sure but my guess it’s an attempt to deal with the problem where sometimes federation activities arrive in the wrong order (especially after an instance has been offline for a while) - by making a GET to the origin server you can be sure you’ve got the latest version of the content. There are probably better ways to achieve that, though.

    PieFed prioritises efficiency over correctness so it just accepts whatever is sent to it. In 3 years no one has complained about seeing stale content although I’m sure it happens occasionally.



  • Lemmy does this to itself, too - when you create a post it federates out and then every Lemmy instance that receives it makes a GET request to retrieve the post from the original server. Even though it just received the exact same data. Some other fedi software is even worse - Akkoma does a GET of the id of every activity it receives, not just for posts but for Likes too.

    It’s insane.

    Anyway, proper caching at the reverse proxy / Cloudflare level solves it. The same kind of caching setup would do the same for sites serving HTML, like NPR too.















  • The main challenge is that we’d need to run the ‘get posts’ database query twice - once with no filters and once with the filters. These are big queries so they’re slow and hard to optimize. You really really don’t want to run them more than once per page load.

    If you wanted a breakdown of which filter caused how many posts then you’d need to run one query per filter and compare it with the no-filter version to see the difference. So, about 6x. Impractical.

    If all the filtering was done in the app logic (rather than on the DB server, using SQL) then it would be trivial to count up which filter did what, as the code looped through the posts. But I’m very sceptical about the performance potential of this, there’s a reason why we do as much filtering as possible on the DB… It’d be an interesting experiment to try.