inaccurate statistics in multitenant database

We are using sql server and have “multi tenant” database. All tables have tenantid + entityid pk. Some tenants have a lot of data and some tenants quite small. Also auto update statistics is enabled.

Sometimes (quite often recently) after auto update of statistics we get inaccurate statistics (depending on sample) and according to it tenant has 1 row (but actually 10-100k). This leads to bad execution plans and performance problem for the whole db.

Maybe somebody has ideas how to fix it.

Understanding of Oracle multi-tenant PDBs

I’m a new user to Oracle. The document states

The CDB root, also called simply the root, is a collection of schemas, schema objects, and nonschema objects to which all PDBs belong.

and

A PDB is a portable collection of schemas, schema objects, and nonschema objects that appears to an Oracle Net client as a non-CDB.

So both CDB and PDB are a collection of schema, schema objects and nonschema objects. How could PDBs belong to CDBs? What does it mean by something like schema object a belong to schema object b?

Implement Multi-Tenant application with Umbraco

I am using Umbraco 7.8.1. I need to develop an application with multi-tenancy where there are multiple communities. Each community has its own database but my code is common. That means all communities with share the code not database which is different from the Multi-Site concept in Umbraco. As i am using Umbraco, i am not able to use Entityframework with my application. Each community will have its own configurations i.e. Database, Storage etc. I am using DevOps for the deployment to achieve this. I am planning to use Feature flags for the community specific code.

I have been digging around for the solution, but till now haven’t found any. Any suggestion on how can I achieve this will be helpful.

Where to apply multi-tenant logic (ASP.Net Core)?

I’m developing a multi-teant SaaS application in ASP.NET core mvc and I was wondering what the general approach is to applying tenant logic in a shared database scenario (TenantId for each entity). And more specificly, where this logic should be applied; In the Context, UnitOfWork, Repository or Service?

My current architecture looks like this:

EF DbContext -> UnitOfWork -> Repository -> Service 

Right now, I’m applying all of my logic in the EF DbContext. For example applying the TenantId to a entity:

public override int SaveChanges( ) {     foreach ( var entityEntry in ChangeTracker.Entries( ) )     {         if ( entityEntry.Entity is ITenantEntity entity )         {             if ( entityEntry.State == EntityState.Added ||                  entityEntry.State == EntityState.Modified )             {                 entity.TenantId = _tenantProvider.GetTenantId( );             }         }     }      return base.SaveChanges( ); } 

And filtering out data based on tenant:

protected override void OnModelCreating( ModelBuilder builder ) {     base.OnModelCreating( builder );      ... omitted ....      builder.Entity<Person>( )         .HasQueryFilter( p => p.TenantId == _tenantProvider.GetTenantId( ) );      builder.Entity<Address>( )         .HasQueryFilter( p => p.TenantId == _tenantProvider.GetTenantId( ) );      builder.Entity<Company>( )         .HasQueryFilter( p => p.TenantId == _tenantProvider.GetTenantId( ) );      ... omitted .... } 

API design for multi-tenant web app – how to identify users from another system?

I have a multi-tenant web application that allows authenticated users to make changes to their application instance – making comments as an example.

I’d like to build an API that allows a user of any external web app to be able to perform an action in my app and record the action as having been carried out by the logged in user of the external app. E.g “Wanda Bloggs commented 3 minutes ago”

Is this possible while keeping the API as generic as possible? (not tied to one specific external app). What should I be looking at to be able to implement this?

Another option is to just mark all API activity something like “API user commented 3 minutes ago” but that way too anonymous and far from ideal.

Any guidance or pointing in the right direction appreciated!

Implement Branching strategy in DevOps for Multi-Tenant application

I have asked this question on Stack Overflow and I got a suggestion of posting it here for better suitability. So here is my question :

I am new to DevOps, and i have a solution with Umbraco as CMS, Mobile App as front-end for the content added in CMS and .Net MVC web API to connect CMS with the Mobile App. I also have WebJobs and Microsoft flow for some scheduling tasks.

I need to implement DevOps for my Multi Tenant Application, here is my scenario:

The solution will have one master application which will just serve as master list of features for admin to enable features while creating new community. Multiple communities having separate databases, each community has multiple features (Feature1, Feature2). There should be a way for developers to forward integrate and backward integrate the features.

After adding the feature to any community, It can have its own customizations in particular feature. In some scenarios developers also need to add these changes to the master or the sibling communities. I also have added the Image for better understanding.

Architecture Image

I need help in creating the Branching Strategy for my solution that fulfils all above requirements and minimize the chances of conflicts while merging the branches all across. I have below options in my mind.

  1. Should I consider each Feature as separate branch? If yes, how about managing the community specific changes done in any single community?
  2. Should I consider each community as separate branch? If yes, how do I separate out the feature code to be merged with the community branch?
  3. Should I consider shared code among all the communities? If yes, what about the community specific changes?

Everything is going to be on the fly once deployed (in code base using Visual Studio 2017). Which strategy I should go for? Or there is any better approach than these? How can i manage to resolve the merge conflicts if generated after the deployment? Also, in DevOps Should i go for Git or TFS?