Menu

How to Build Multi-Tenant SaaS in Symfony Without Sacrificing Database Isolation
📰

How to Build Multi-Tenant SaaS in Symfony Without Sacrificing Database Isolation

HackerNoon·MattLeads·about 19 hours ago
#ap9BC8GY
#hackernoon#technology#tenant#uuid#request
Reading 0:00
15s threshold

Database-per-tenant is the safe way to build a B2B SaaS on Symfony. Every workspace gets its own PostgreSQL database, its own queue and its own bucket, so a missing WHERE tenant_id = ? cannot leak anything and a big customer can be moved to a bigger server by changing a DSN. The usual price is a deployment per tenant: a php-fpm pool, a couple of Messenger workers and a scheduler, always on, whether the tenant is used or not.

That price is fine while every tenant pays. It stops being fine the day you add a free plan. In our case two out of three workspaces had no paid plan, most of them had not been opened in weeks and their always-on processes were the main reason the nodes ran out of memory. Cost grew with the number of tenants, not with their usage and at a few hundred free tenants it would have eaten half the revenue of the paying ones.

The standard fixes trade the isolation away.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.