4 ms·
Ask HN: How did you get multitenancy right?
Hello, HN!
I'm currently maintaining the backend of a "job board" application. This application allows nonprofits to register and publish free volunteering opportunities, and lets volunteers search and apply for jobs.
The thing is, some companies want their own platform for their employees to do volunteer work. Sometimes we also fire up platforms for specific volunteering events/dates. We want to keep every client/platform on their own server, with their own database. This would be perfect for us except for one thing, sometimes we want to integrate two or more platforms.
Eg: There's a client who has a country wide platform, but he also has 2 platforms specific for two cities/communities(cities A and B). Projects hosted on the country-wide platform that are on city A, should show up on the A-city platform. Also, all projects on the A-city platform should show up on the country wide platform.
So, basically what we want is to have multi-tenancy but allowing data to flow freely between multiple platforms/websites.
Our current solution involves sharing a database between all the platforms and every table has a 'channel' column, where we tag which site the row is from. Using this we can design content flow rules between the channels. The downside is that all the data is cramped together now, with unrelated clients sharing the same database and this will be hard to scale, insecure and hard to maintain.
With this being said, we are looking for a solution that allows us to integrate multiple tenants data, we've been looking currently at stuff like PostgreSQL dblink and at the idea of duplicating data but every solution we see seems to have huge flaws.
With all that being said, how did you solve your multitenancy problems? What should we consider?
- karmakaze 7y agoSeparate VMs per customer with encryption at rest. It requires automating everything as every action has to be done per customer. Perhaps the least cost effective, but easy security and billing--if they want more capacity scale up their instances and bill. There's also a central db that handles routing.
- nishantvyas 7y agofor multi-tenancy users(=customers) there are 3 main solutions, 1) Single DB with a) dedicated table per user or b) shared table with column that identify the user 2) Dedicated Schema for every user. 3) Dedicated DB for every users. there is no good answers and you'll find everyone have solved it differently as they scale... few biggest names i can think of my haed are SalesForce, Workday and ServiceNow