tenancy / multi-tenant

Run multiple websites using the same Laravel installation while keeping tenant specific data separated for fully independent multi-domain setups, previously github.com/hyn/multi-tenant
https://tenancy.dev
MIT License
2.54k stars 391 forks source link

Connection Pooling #983

Open fernandocoronatomf opened 3 years ago

fernandocoronatomf commented 3 years ago

Hey guys,

This isn't as much a feature request, but a question about connection pooling. This package is amazing for data segregation and it integrates greatly with laravel queues, caching, artisan, etc.

The problem we're having is that the application grew a lot and we allow clients to self onboard themselves, which creates a tenant (database schemas) for each time they do that.

I might be wrong but as far as I've researched, enabling connection pooling in Laravel will create a connection for every schema we have. Assuming we have 400 tenants, then it would be 400 connections at any given time, which might be expensive.

I am wondering if anybody has any tips regarding this issue or any reading that can further help?

Thanks

Information

mbnoimi commented 3 years ago

I asked a similar question too but in much simpler way.

Can I use tenancy for multi-tenant app uses a single connection pool? I don't want to create a connection pool per tenant (just want a single connection pool for multi-tenant) In PostgreSQL usually we use a schema per tenant which means the app uses a single database with multi schemas.

fernandocoronatomf commented 3 years ago

@mbnoimi Yeah, same deal but I am using MySQL. Would be great to have some insights from other people facing the same problem.