Skip to content
  • 6 Votes
    1 Posts
    135 Views
    julianJ
    For awhile I've been wondering what the slow-down was when I loaded /world, the curated timeline for a NodeBB user. Seemingly every time I figured out what it was, it would slow down again after some time. Today it was taking 3+ seconds to load just the data, whereas our other pages (category listing, topics, etc.) all finish in under 250ms, including html generation, user data, etc... Certainly something was amiss! As it turns out, asking your database to do an intersection of two data sets, one containing 23774 items, and the other containing 23606 items, is a little much. I guess this is what they mean when they talk about #webscale hah! (#fediscale?) Specifically, I was intersecting the set containing all fediverse topics, with the set containing everything in the user's inbox, in their entirety. While this gave me a very precise answer, there was a huge cost to that precision. After talking with @baris about this, we decided that sacrificing some level of precision would almost certainly go unnoticed. Instead of having the database intersect those two data sets, we would pull the most recent 500 entries from both and intersect them manually. So, /world is now limited to 500 topics. Don't worry, you won't notice. That simple fix brought the execution time down from ~1500ms to ~40ms, which is more in line with our expectations!