Christophe,
There are trade offs with all the approaches, you just need to see
which ones you can live with. (I'm sure I'm missing some points, but
this should be a good starter)
Case 1, Separate application and separate databases:
Pros:
- You get easy scalability. You don't need to think about sharding
later on, since you are starting sharded.
- In addition, you can easily use different hardware per client. Let's
say if a client gets REALLY big, you can put them in their own
environment, their own replication tree, etc.
- You can install the app at the client's datacenter
- You can upgrade each client separately
- You can even host each client at different geographical location
(closer to the client)
Cons:
- This model won't work if you need to have relations between multiple
tenants
- You need to manage multiple databases and application servers
- You will end up with many different versions of app and dbs
- Bug reports won't be uniform because of the versions, so fixes need
to be applied to each version in production
Case 2, One shared application and separate databases (I'm assuming
you would want to keep the same schema on all databases):
Pros:
- Just like #1, you get easy scalability. You don't need to think
about sharding later on, since you are starting sharded.
- Just like #1, you can easily use different hardware per client
database.
- Just like #1, you can host each client's database at different
geographical location (closer to the client)
Cons:
- This model won't work if you need to have relations between multiple
tenants
- You need to manage multiple databases
- You can't effectively use this if you use JPA, since JPA
implementations create an EntityManager per database (this could waste
a lot of memory)
Case 3, One shared application and one shared database:
Pros:
- Only one monster to tame
- Uniform database and app versions
- Can have relationships between tenants
Cons:
- It's harder to scale, you need to do the sharding at application
level
- You're putting all your eggs (data) in one basket
As you see, there are tradeoffs with each approach. You need to really
think about your apps requirements and plan accordingly. At the end of
the day, the writes are always the bottleneck, so you need to play a
divide and conquer with the writes. The more you can divide logically,
the easier it will be to scale the system. I would say take a look at
the CAP theorem too,
http://www.julianbrowne.com/article/viewer/brewers-cap-theorem
HTH,
Drew
On Oct 24, 6:13 am, Christophe <
christo.ribe...@gmail.com> wrote:
> Hi,
>
> I will develop a SaaS application, and I learn about Multi-tenancy
> models. I found 3 models (herehttp://
www.ibm.com/developerworks/cloud/library/cl-multitenantsaas/?c...