Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What the conceptual difference between tenant and namespace

I'm faced with the tenant term a little time ago in context of Stormpath and after in context of Google Cloud Datastore. And what made me crazy about this, is why we where need to introduce new term to define a namespace? Or maybe I'm missing something that describes tenant's specific qualities that namespace doesn't have?

And although, in this whole concept I'm still can't get the concept of the multitenancy here? What the point of multitenancy? It just looks like multinamespaces thing, but with the same structure.

So, what the difference betwen this two terms?

like image 289
QuestionAndAnswer Avatar asked Apr 08 '17 18:04

QuestionAndAnswer


1 Answers

In Datastore, one would use Namespaces to create a multitenant structure.

Example:

Let's say you want to create a social network, like Facebook, but simplified. You'd have users, posts, and comments.

Entities

  • users
  • posts
  • comments

Namespace

Instead of declaring a 'post' entity as a child of 'user' entity, you can assign a namespace (user-ID) to the 'post'.

In terms of data structure, it might seem there's no difference, but in terms of performance, it does. When you declare an entity as a child of a parent, Datastore will need to store all children together and assure consistency of data within that parent. When you assign a namespace to an entity, it can distribute the data and doesn't guarantee absolute consistency.

That's why Datastore limits to 1 write per second (on average) within each Parent, but doesn't impose write limits within a namespace.

What does 'Consistency' mean?

In this example, let's say Jack published a post right now. Mary and John are his friends. If Mary and John access Jack's posts right after Jack posts, is it 100% guaranteed that both will see this new post?

  • If the post is a child of user (Jack), they will.
  • If the post is in the user (Jack) namespace, it might not be true at a given point of time; eventually, both will see the post, but it might take some time for the change to propagate.
like image 157
Renato Byrro Avatar answered Nov 15 '22 14:11

Renato Byrro