jointakahe / takahe

An ActivityPub/Fediverse server
BSD 3-Clause "New" or "Revised" License
1.12k stars 86 forks source link

Synchronous stator pinning CPU core #602

Closed rcarmo closed 1 year ago

rcarmo commented 1 year ago

With the new synchronous stator, running Takahe on a small server has become very challenging - I now have CPU usage at 100% all of the time, which makes it quite hard to run anything else on a single-core VM. Comparably, CPU load has effectively doubled.

andrewgodwin commented 1 year ago

Yes, this is because the new implementation is ironically significantly faster - it's no longer bound to a single database connection, for example, and instead uses one per thread. I'm seeing just one stator do the job of four or so previously in my deployment.

In your case, I'd recommend reducing the concurrency limit down to get it to match your VM size - ./manage.py runstator --concurrency=5 might be a good start. I'd also potentially suggest excluding identities and domains from a main stator and running a very resource limited second one for those, as they tend to be the majority of the work.