kev,
@kev@fosstodon.org avatar

Every time I post a link to my site on Mastodon, it locks up for like 30 seconds or so.

My theory is that because I have a quite a lot of followers (👋 hii!) the post hits a lot of instances and they all poll my site at the same time, effectively DDoS'ing it for a lil bit.

One day I'll run a packet capture and prove this theory…

jeroen94704,
@jeroen94704@fosstodon.org avatar

@kev yes, all instances immediately grab a snapshot for the preview/thumbnail

anze3db,
@anze3db@fosstodon.org avatar

@kev I see the same thing. My little raspberry pi’s cpu spikes up every time I post a link, but it isn't too bad. I have fewer followers than you though 😅

dustinrue,
@dustinrue@chateaude.luxe avatar
kev,
@kev@fosstodon.org avatar

@dustinrue Ohhhh this is useful, thanks. I have considered a move behind Cloudflare in the past, for exactly this reason, but CF makes me feel icky. So I’ve jsut kinda put up with the ~30seconds downtime when something is posted.

I only serve my font files from my CDN. I should fix that…

mauricerenck,
@mauricerenck@mastodon.online avatar

@kev don’t you use Kirby? I can recommend the staticache plugin. It helped me a lot with issues like that.

kev,
@kev@fosstodon.org avatar

@mauricerenck I do. I prefer not to use plugins when I can help it. I do use caching in Kirby, but it’s the basic file cache that comes bundled. I’ll check out Staticache though.

dustinrue,
@dustinrue@chateaude.luxe avatar

@kev any cdn or even local configured nginx can do the same. Just need to configure it

kev,
@kev@fosstodon.org avatar

@dustinrue I’ve plopped nginx in front of Apache and setup caching. Will be interesting to see if it works next time.

picofarad,
@picofarad@fosstodon.org avatar

@kev @dustinrue https://www.webpagetest.org/

test with and without, and if you notice a slowdown do it as soon as possible, it'll show in the waterfall where the delay is - probably images

nginx probably fine. squid, too. probably better to serve tiny images for previews.

kev,
@kev@fosstodon.org avatar

@picofarad @dustinrue This spawned a thought…I checked the head of my site for where the favicon and “feature-image” is being served from. I thought this was my CDN, but it wasn’t, it was local.

I’ve now changed that to my CDN, so we will see if that fixes the issue next time a link is posted. Thanks.

slink,
@slink@fosstodon.org avatar

@kev @dustinrue i heard people say was quite fit for the job

fishy, (edited )
@fishy@fosstodon.org avatar

@kev
just use httpd request log? like https://fosstodon.org/@fishy/110278779373882502

LexPendragon,
@LexPendragon@QuarteredCircle.net avatar

@kev I was one of them, sorry.

Nice site, though!

kev,
@kev@fosstodon.org avatar

@LexPendragon The problem isn’t people visiting, it’s a mastodon thing. Whenever a link is posted, Mastodon polls the site to pull things like a feature image, and some other meta data. This, as I understand it, is so Masto can display the card.

I have around 26k followers, so let’s say that’s over 500 instances. That’s 500 servers, all making requests to my lil server at the same time.

picofarad,
@picofarad@fosstodon.org avatar

@kev @LexPendragon I'm getting curious now

i don't have 26k followers, though

mms,
@mms@emacs.ch avatar

@kev you can also tail logfile.

kev,
@kev@fosstodon.org avatar

@mms Problem is, Mastodon doesn’t provide a referrer (and rightly so) so doing a tail on the logs after the fact won’t really help. I’ll just see a load of IPs.

That’s why I’d like to do a pcap, as it would show a spike in real-time.

mms,
@mms@emacs.ch avatar

@kev the instance is appended to user-agent IIRC

kev,
@kev@fosstodon.org avatar

@mms yup, it does. Every day’s a school day. Thanks.

  • All
  • Subscribed
  • Moderated
  • Favorites
  • random
  • kavyap
  • thenastyranch
  • ethstaker
  • DreamBathrooms
  • osvaldo12
  • magazineikmin
  • tacticalgear
  • Youngstown
  • everett
  • mdbf
  • slotface
  • ngwrru68w68
  • rosin
  • Durango
  • JUstTest
  • InstantRegret
  • GTA5RPClips
  • tester
  • cubers
  • cisconetworking
  • normalnudes
  • khanakhh
  • modclub
  • anitta
  • Leos
  • megavids
  • provamag3
  • lostlight
  • All magazines