
Ask HN: How did you get multitenancy right? - haxy
Hello, HN!
I&#x27;m currently maintaining the backend of a &quot;job board&quot; 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&#x2F;dates. We want to keep every client&#x2F;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.<p>Eg: There&#x27;s a client who has a country wide platform, but he also has 2 platforms specific for two cities&#x2F;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.<p>So, basically what we want is to have multi-tenancy but allowing data to flow freely between multiple platforms&#x2F;websites.
Our current solution involves sharing a database between all the platforms and every table has a &#x27;channel&#x27; 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.<p>With this being said, we are looking for a solution that allows us to integrate multiple tenants data, we&#x27;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.<p>With all that being said, how did you solve your multitenancy problems? What should we consider?
======
karmakaze
Separate 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
for 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

