Rails Multi-Tenancy with Mike Dalessio
By 37signals
Categories: Startup, Product
Summary
Implementing multi-tenancy in Rails is a complex challenge - 37signals almost launched a product with a unique SQLite-based approach, but ran out of time. The payoff for overcoming these hurdles can be significant, enabling thousands of customers to be served with a single application.
Key Takeaways
- Rails does not make it easy to implement multi-tenancy, requiring developers to carefully manage data separation in all models.
- Storing each customer's data in a separate SQLite file on disk was an innovative approach 37signals explored to avoid scaling a single database.
- Scaling a co-mingled database to support thousands of customers requires significant infrastructure and operational effort, an issue multi-tenancy can help address.
- Even for an experienced Rails team like 37signals, implementing a robust multi-tenant architecture was an immense technical challenge that they ultimately couldn't complete in time for their product launch.
- The potential benefits of multi-tenancy, like keeping customer data fully separate and private, are significant enough that teams should consider investing in this complex technical work.
- Storing each customer's data in a separate file-based database like SQLite is an innovative approach to multi-tenancy that could unlock new deployment models for SaaS applications.
Topics
- Rails Multi-Tenancy
- SaaS Architecture
- Database Scaling
- Technical Challenges
- Innovative Deployment Models
Transcript Excerpt
That's the kind of thing that multi-tenency can give you as well. It's not necessarily between customers, but it's just keeping your data separate and having that database connection handled really gracefully and very seamlessly by Rails. The Rails does not make your life easy when you want to work in this way when you have multiple tenants in all sitting in one database. I wanted to make it as hard as possible for a developer to accidentally shoot themselves in the foot. Welcome back to another...