Yeah, the idea of a dedicated app server seems reasonable after a certain point. That kind of goes against the whole serverless architecture that Supabase is going for though. There's got to be a way to organize serverless functions, database configurations/migrations in a more seamless manner. Hmm...If people currently employ conventions to manage their serverless functions, then applying those principles to PostgreSQL might also work. I'll look into that next.
The issue with that though is that you end up with spaghetti functions, and managing interactions across multiple functions becomes difficult, so at the very least you need guidance on keeping function interactions to a minimum. When that's not possible...well, I'll need to think about that. I recently came across Event-Driven Microservices which presents the idea of an orchestrator that manages operations. That sounds promising, and the question then becomes "where does the orchestrator live? in the PostgreSQL DB, or a separate server. Perhaps when it becomes big enough, you deploy it by itself, but you start out with a PLV8 function.
As for PLV8 performance, I see that it starts a new global js runtime context for every session, but I need to understand whether that's the same as the global execution context (which would be nice) or if they're talking about starting up an entirely new process for every session (which seems expensive)...will come back in a bit.