this post was submitted on 03 Sep 2023
7 points (81.8% liked)

Fediverse

28396 readers
1031 users here now

A community to talk about the Fediverse and all it's related services using ActivityPub (Mastodon, Lemmy, KBin, etc).

If you wanted to get help with moderating your own community then head over to !moderators@lemmy.world!

Rules

Learn more at these websites: Join The Fediverse Wiki, Fediverse.info, Wikipedia Page, The Federation Info (Stats), FediDB (Stats), Sub Rehab (Reddit Migration), Search Lemmy

founded 1 year ago
MODERATORS
 

So both lemmy and lotide were having big problems where they'd get totally overwhelmed, especially once I started federating with huge instances. At first I thought it was because my servers aren't very powerful, but eventually I got the idea that maybe it's because it can't keep up with federation data from the big instances.

So I decided to limit the connections per IP address. Long-term testing isn't done yet, but so far both my lemmy and lotide instances aren't getting crushed when they're exposed to the outside world, so I think it's helping.

In /etc/nginx/nginx.conf, under the http section, I added the line "limit_conn_zone $binary_remote_addr zone=conn_limit_per_ip:10m;"

Then, in my sites-available folder for the services, I added "limit_conn conn_limit_per_ip 4;" or something similar. Both lemmy and lotide have different sections for ActivityPub and API, so it appears I can limit the connections just to those parts of the site.

It's only been a few days, but whereas before both instances would die randomly pretty quickly once exposed to the outside world, now it appears that they're both stable. Meanwhile, I'm still getting federated posts and comments.

top 2 comments
sorted by: hot top controversial new old
[โ€“] pnutzh4x0r@lemmy.ndlug.org 2 points 1 year ago (1 children)

I think this is part of the recommended (external) nginx configuration for lemmy:

limit_req_zone $binary_remote_addr zone={{domain}}_ratelimit:10m rate=1r/s;

Which can be found here

[โ€“] sj_zero@lotide.fbxl.net 2 points 1 year ago

That explains a lot. I run everything on bare metal, and I don't think the bare metal instructions included that.