Multitenancy application and structure

Asked

Viewed 219 times

1

Saas applications are getting higher, reducing costs, maintenance, etc.

We know we have the concept: Multitenancy (http://msdn.microsoft.com/en-us/library/aa479086.aspx)

It’s them:

By Column: Place an idClient column in all tables

By Schema: Separating clients by schema, cliente1.contaspagar cliente2.contaspagar cliente123234234.contaspagar etc

By Database: Each customer with their database.

My doubt:

The separation by Column, tends to be the easiest, however, when viewing from a DBA is very bad? if it has more than 130 tables and about 200 clients?

What about security? Remembering that what separates the data of each client, is a simple "Where" Where idclient = ? Or how that security could be made?

And performance? of queries, Inserts,delete

Databases that will be created with this structure: Sql Server, Mysql (Structure generated with Entity Framework)

1 answer

3


Column separation

DBA View and Performance

The amendment will always require a composite index, which is larger and slower than the index based on only one column.

Security

It is the most insecure separation of all, no doubt, because all operations of selection and handling of records are separated by a conditional.

How to solve?

There are some ways:

  • All bank operations on top of Views; Views referencing only one table;
  • Manipulating context-related events to include the customer key where possible;

Entity Framework Point of View

The configuration becomes more expensive, because all entities will have two or more keys. The application’s Scaffold becomes more complicated and ineffective. Operations tend to be slower because it is an extra column to be observed by the context.

  • 1

    Thanks Gypsy, I’m still in the fight of Saas with Entity Framework rsrsrs, it would be easier to create separate by schema or database with the Entity framework?

  • I think it is better to separate by database. Everything becomes simpler.

  • What about Entity Migrations? Does it accept multiple bases? I remember you helped me with a question about SPA, that I would only use Webapi, I gave up, I will use Asp.net’s MVC and I will only use the "SPA" in the Home that renders with @renderbody, then it is easier to access by begin_autentication right right

  • You can write one system and open multiple sites on your server, each database serving a different client. EF even accepts multiple bases, but I see no need to use multiple contexts at the beginning of its application.

  • did not mean multiple contexts in the application, 1 single deploy, then passes the database to the user to authenticate, only leave configurable context, what you think?

  • This is possible and quite easy to do. Each client would have its database. When authenticating, you make the user connect to a specific context.

  • I got it =D thanks Gypsy, I don’t know how to thank you kkk even, soon I go to Uritiba to do a training, I buy you a beer there kkk

  • @Rod I live in São Paulo, man. I go to Curitiba only once or twice a month. In my profile there is a link for you to pay me a shit, if you want huahuahaua

Show 3 more comments

Browser other questions tagged

You are not signed in. Login or sign up in order to post.