To all mastodon admins:

Hi! I’m Evan Phoenix, the primary author of puma, the ruby webserver that powers mastodon!

Please reply or DM me if you need tuning help! I’ve got no officiation with the mastodon, just want to see you succeed!

(Quick Tip: set WEB_CONCURRENCY to core count * 1.5 and then tune MAX_THREADS. High thread values will see diminishing returns!)

@evanphx Careful with that 1.5 value. Sidekiq needs to run too.
@getajobmike For sure! Setting WEB_CONCURRENCY to cores * 1.5 can result in puma soaking up 100% of the cpu. So if you're running sidekiq on the same cores, use 1 * cores or even 0.8 * cores is prudent.
@evanphx @getajobmike In a fresh install of Mastodon following the guide, Puma doesn't read .env.production on boot, so if you want to change the number of workers you either need to edit config/puma.rb or the mastodon-web.service to set e.g. Environment="WEB_CONCURRENCY=3".

@evanphx @getajobmike Additionally, since y'all are giving formulas with floating point math, make sure to round up or down to an Integer value to keep Puma happy.

If you're running a small VPS with e.g. one core for a small number of users, consider setting WEB_CONCURRENCY=0 to take Puma out of clustered mode.

@mwp @getajobmike Yup! Not being in cluster mode will save a small amount of memory as well.