Skip Navigation

lemm.ee just got faster! (infra upgrades)

Hey lemmings!

I wanted to share a quick update about our recent performance issues and how I have addressed them.

The last 24h have been a bit rough for lemm.ee.

Last night, I spent some time debugging federation issues with lemmy.world. We managed to significantly improve the situation - lemmy.world content is now reaching lemm.ee with a very high success rate - but this has had the effect of increasing incoming federation traffic on our servers significantly.

Additionally, we have been seeing steadily increasing normal user traffic over the past week, which is awesome from a community standpoint, but of course means that our servers have to do more work to keep up with all the new people.

To top things off, today there appeared a badly configured instance in the network, which was effectively launching a DoS attack against lemm.ee for several hours. Most likely it was unintentional, but unfortunately the end result was a sudden increase in our server load.

All these factors combined resulted in a really bad experience for most lemm.ee users today. Page load times have consistently been spiking into as much as 10 seconds or more for the whole day:

In fact, a lot of page loads just timed out with errors.

Fortunately, it seems I have managed to clear up the problems!

I have put a bunch of mitigations in place, and after monitoring the situation for the past hour, it seems that our performance issues have been resolved for now. So hopefully, you can enjoy browsing lemm.ee again without it feeling like torture!

Here are specific steps I took:

  • I have doubled the hardware resources for our backend servers and database.
  • I purchased a Cloudflare pro subscription for lemm.ee for 1 year. This took out a considerable chunk of my budget for lemm.ee, but in return it will allow me to analyze and optimize our cache usage to a far greater extent. I am already seeing vastly reduced load times for cacheable content (try opening https://lemm.ee a few times in a row as a logged out user - it should be blazing fast now!)
  • I have configured a rate limiter which will prevent future DoS from the specific method that was used against us today.

Of course, all of the above is costly. Luckily, lemm.ee users have been very generous with donations in the month of June, and in fact a significant amount of donors have opted for monthly recurring contributions. This all gives me the confidence to increase our spending for now, and I am currently expecting to NOT increase my personal planned contribution of 150€/month, as the increased costs so far are entirely being covered by donations!

Let me take this opportunity to thank the sponsors who made the upgrades possible! All lemm.ee users are now enjoying better performance thanks to you, I could not have done it without you awesome people.

On a final note, I just want to say that I hope a lot of these issues can be solved by optimizations in Lemmy software itself in the future. I have been personally contributing several optimizations to the Lemmy codebase, and I know many others are focused on optimizations as well. Just throwing extra resources at the problem will probably not be a sustainable solution for very long 😅. But I am optimistic that we are moving in the right direction with the software changes, and we'll be enjoying reduced resource needs before long.

That's all I wanted to share today, I wish you all a great weekend!

105 comments
  • On a side note, really liking this 0.18.1 release candidate version, the 0.18.1 official release is going to be brilliant. The new compact view is beautiful and it scales with window width nicely. They just need to drop the post header size a bit and the compact view will be perfect. This release candidate seems to be pretty solid, only seeing fixes, no new bugs.

  • I have configured a rate limiter which will prevent future DoS from the specific method that was used against us today.

    For those of us running other Lemmy instances, what should we be looking for?

    • While a generally a good idea, this information is better shared privately

  • Wanted to share something from my experience running a pleroma instance: I was having an issue where postgresql was becoming more and more of my CPU utilization. It looked like I was going to have to buy a seriously upgraded server, my loads like 3-4 constantly.

    I ran pg_repack during a lower traffic hour (site continued to run during the run but at reduced performance) and my loads were down by 90%, to much less than 1. Now I have it set to do a repack weekly (ymmv, it just seemed like a good frequency to me)

    Haven't done it to my Lemmy server yet, but that's because of all my instances this one is the newest.

  • Can you tell me what you've cached? I'm not using cloudflare but I am using haproxy which has frontend caching builtin. It was next on my plan but if you share your caching setup I can try to replicate it on lemmy.dbzer0.com

    • Mostly all images are served through a cache. I would like to also cache some static HTML (such as pages for unauthenticated users), but it breaks due to some users requesting these pages with an Accept header for an activitystream content-type, and I haven't had time to figure out a solution for accounting for the content type in my cache key unfortunately 😅. But if you can do that easily in your cache then for sure you could also cache any static pages for a minute or so.

      • Ye I can cache differently depending on headers. Surprised that caching images helps a lot since your pictrs is hosted in an independent box anyway

  • Thank you @sunaurus@lemm.ee for all of your work. I am continually realizing that I chose the right instance with how transparent and responsive you have been.

  • Yeah the slowdown was a bit rough, been browsing off and on all day today. Thanks for fixing that. Seems to be working a lot better now. That's a bummer you had to increase expenses though.

  • It's great to see the good work you instance admins are doing on building the infrastructure. I may have settled on a different instance, but lemm.ee seems to have a great community and I love the openness here.

  • This is so awesome! Thank you for everything you've done. You continue to prove my belief that this is the best instance to be on.

  • Thanks!

    I'm definitely seeing an increase in speed. I think at some point there will be a market for servers that users must pay to use. For the time being, I'm more than happy to contribute to a server that is open to all, but good speed needs to be there.

  • Awesome instance. Really fast speed (compared to sh.itjust.works), there is no blocked instances/communities. Kudos❤️

  • I've just joined up to lemme.ee and subscribed to a community on another instance. I can see the posts in that community, but they all show up with zero comments. If I view the community on the web, there are several comments there. Is this a bug?

    The community is !nrl@aussie.zone

    • It is a federation thing. Newly federated communities don't load comments with their initial import. You'll start to see comments as you go.

    • Just to add to the other reply, if there's an old comment chain you really want to reply to you can grab the URL of the last comment, search for it through your home instance and that'll force an index of the comment you searched for plus any parents.

  • Once again, thank you for making this small pleasant corner of the Internet possible!

  • To this day I have still lots of "subscribe pending" in my communities options page, especially from lemmy.ml and lemmy.world

    Should I try to cancel them and redo or just wait?

    https://imgur.com/a/rJEH1Di

    (I cannot upload images anymore, I get a JSON error now)

    • You should be able to cancel and retry lemmy.world - there's a high chance those will go through now.

      With lemmy.ml, there's a much lower chance, better to wait until they upgrade to 0.18.1.

  • How much of the slowdown was caused by the bad instance VS the limitations of the previous hardware?

    • The DoS was responsible for about 10-20% increased load on our system - it wasn't the root cause of the slowdowns, it was more like a nice cherry on top of the cake 😅 The bigger issue is the constantly increasing federation load.

  • I don’t mean to grossly oversimplify… But does this mean it’s time to upgrade to 0.18.1?

    • Generally I would recommend against running RC builds. I was willing to take the risk in this case for lemm.ee, because:

      • I feel comfortable with debugging and fixing issues in code as they crop up
      • I have been working myself on stabilizing 0.18.1 and am pretty well aware of its current state
      • The set of problems in 0.18.1-rc4 is a bit better than the different set of problems we had with 0.17.4 😅

      At the end of the day, you have to acknowledge the risks and see if they're worth it for you.

105 comments