Snac run as a daemon.
I wonder how hard it would be to turn it into a cgi: it should start, read the config, execute the task requested via HTTP (read from stdin) and close.
Maybe lock when appropriate.
Also (despite not being an issue for such service) I wonder how much the performance would suffer.
Thanks for the insights!
@grunfink @Shamar Maybe related, Richard Hipp gave some numbers for Fossil running as CGI on sqlite.org https://fossil-scm.org/forum/forumpost/fdd3d9c271ceb378?t=h
For ActivityPub I guess one need to be able to push activity outside the cgi to make it efficient? Either running using cron or a different submit-like (sendmail-ish) service.
- The maximum number of simultaneous processes would be harder to control (it should be done on the frontend http server, and that would require specific configuration for every server implementation).
- Every activity (likes, boosts, posts) generates a very big bunch of connections. After a new one, the process should manage the full queue and not exit until it's done. If there are a bunch of these operations still running, the http server would not open on new queries, or at least it will require some configuration tuning. As it's now, it's trivial to reserve resources and give top priority to incoming requests.
- And most important, the problem of retries. The fediverse is a jungle of overloaded, fallen, slow servers. Activity messages should be stored somewhere to be retried later, probably after a timer. This is much harder to manage from a CGI, that only runs on demand.
As I say, it's not impossible, but a project with this approach should be carefully developed taking this thinks into account.