Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SaaS database design - Multiple Databases? Split? [closed]

I've seen SaaS applications hosted in many different ways. Is it a good idea to split features and modules across multiple databases? For example, putting things like the User table on one DB and feature/app specific tables on another DB and perhaps other commonly shared tables in another DB?

like image 807
Vyrotek Avatar asked Sep 16 '08 03:09

Vyrotek


People also ask

What is multi tenant database design?

Multi-Tenant – Multi-tenancy means that a single instance of the software and its supporting infrastructure serves multiple customers. Each customer shares the software application and also shares a single database. Each tenant's data is isolated and remains invisible to other tenants.

Can I use 2 databases?

You can use two databases the same reason most banks have two ATMs, for reliability.

Can a system have multiple databases?

Many organizations are opting for a hybrid infrastructure that combines on-premises and cloud resources to furnish the systems and applications needed to run a business. An average company can have multiple databases running on different infrastructures that all need to be managed and maintained by a single team.

What is SaaS database?

Software as a service (SaaS) is a cloud-based software delivery model in which the cloud provider develops and maintains cloud application software, provides automatic software updates, and makes software available to its customers via the internet on a pay-as-you-go basis.


2 Answers

Start with one database. Split data/functionality when project requires it.

Here is what we can learn from LinkedIn:

  • A single database does not work
  • Referential integrity will not be possible
  • Any data loss is a problem
  • Caching is good even when it's modestly effective
  • Never underestimate growth trajectory

Source:

LinkedIn architecture

LinkedIn communication architecture

like image 193
Sergey Kornilov Avatar answered Oct 02 '22 21:10

Sergey Kornilov


High Scalability is a good blog for scaling SaaS applications. As mentioned, splitting tables across databases as you suggested is generally a bad idea. But a similar concept is sharding, where you keep the same (or similar) schema, but split the data on multiple servers. For example, users 1-5000 are on server1, and users 5000-10000 on server2. Depending on the queries your application uses, it can be an efficient way to scale.

like image 43
Tom Ritter Avatar answered Oct 02 '22 23:10

Tom Ritter