Base solution for your next web application
Open Closed

Tenant Creation Performanace #4442


User avatar
0
pankajmathur created

Hi,

While we create a new tenant on azure it takes almost 3 to 5 minutes to create a new tenant. While analyzing where exactly it is taking time, we found that the following statement in the TenantManager.cs class takes too much of time to finish execution. _abpZeroDbMigrator.CreateOrMigrateForTenant(tenant);

Any idea what must be wrong? Please advice how can we increase the performance of creating a new tenant?

Regards, Mahendra


9 Answer(s)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @pankajmathur,

    This method creates a new database and applies migrations on that database. I think this is probably something on azure side you can try to improve performance.

  • User Avatar
    0
    pankajmathur created

    Hi,

    Apart from slow performance, it also throws Internal Error at times. The error is not consistent in nature, At times it creates the tenant successfully (though its slow), but at times it also fails. When it fails, it even not creates the database. The internal error that gets thrown at times is what we are more worried about. We have around 50 tables apart from the one that ABP and ASPNetZero have. Please advice...

    Regards, Mahendra

  • User Avatar
    0
    bbakermmc created

    You would need to provide the errors. Also have you tested against a local SQL box to determine if it just Azure? My guess is its Azure and something might need to be tweaked on the context to allow for longer time outs or a setting.

  • User Avatar
    0
    pankajmathur created

    Yes, I am trying to creating tenant on Azure. At times it creates successfully. But at times it fails with the following error. Please advice.

    Exception: System.InvalidOperationException: Internal .Net Framework Data Provider error 6. at System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection) at System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection) at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, UInt32 waitForMultipleObjectsTimeout, Boolean allowCreate, Boolean onlyOneCheckConnection, DbConnectionOptions userOptions, DbConnectionInternal& connection) at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, TaskCompletionSource1 retry, DbConnectionOptions userOptions, DbConnectionInternal& connection) at System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection) at System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource1 retry, DbConnectionOptions userOptions) at System.Data.ProviderBase.DbConnectionClosed.TryOpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource1 retry, DbConnectionOptions userOptions) at System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource1 retry) at System.Data.SqlClient.SqlConnection.Open() at Microsoft.EntityFrameworkCore.Storage.RelationalConnection.Open(Boolean errorsExpected) at Microsoft.EntityFrameworkCore.Storage.Internal.SqlServerDatabaseCreator.<>c__DisplayClass18_0.b__0(DateTime giveUp) at Microsoft.EntityFrameworkCore.ExecutionStrategyExtensions.<>c__DisplayClass12_02.b__0(DbContext c, TState s) at Microsoft.EntityFrameworkCore.Storage.Internal.SqlServerExecutionStrategy.Execute[TState,TResult](TState state, Func3 operation, Func3 verifySucceeded) at Microsoft.EntityFrameworkCore.ExecutionStrategyExtensions.Execute[TState,TResult](IExecutionStrategy strategy, Func2 operation, Func2 verifySucceeded, TState state) at Microsoft.EntityFrameworkCore.Storage.Internal.SqlServerDatabaseCreator.Exists(Boolean retryOnNotExists) at Microsoft.EntityFrameworkCore.Storage.Internal.SqlServerDatabaseCreator.Create() at Microsoft.EntityFrameworkCore.Migrations.Internal.Migrator.Migrate(String targetMigration) at Microsoft.EntityFrameworkCore.RelationalDatabaseFacadeExtensions.Migrate(DatabaseFacade databaseFacade) at Abp.Zero.EntityFrameworkCore.AbpZeroDbMigrator1.CreateOrMigrate(AbpTenantBase tenant, Action1 seedAction) at Abp.Zero.EntityFrameworkCore.AbpZeroDbMigrator1.CreateOrMigrateForTenant(AbpTenantBase tenant, Action1 seedAction) at Abp.Zero.EntityFrameworkCore.AbpZeroDbMigrator`1.CreateOrMigrateForTenant(AbpTenantBase tenant) at CitiXsys.iVend365.MultiTenancy.TenantManager.d__15.MoveNext() in D:\Development\CXSRetail\Development\iVend365\src\CitiXsys.iVend365.Core\MultiTenancy\TenantManager.cs:line 192

  • User Avatar
    0
    pankajmathur created

    Also, I have following timeout set

    public iVend365DbContext(DbContextOptions<iVend365DbContext> options) : base(options) { Database.SetCommandTimeout(1000); }

  • User Avatar
    0
    bbakermmc created

    Its related to azure not AspNetZero from what I can tell. Seem to be a common issue with Azure and Elastic DBs

    <a class="postlink" href="https://stackoverflow.com/questions/42027191/internal-net-framework-data-provider-error-6-in-sql-azure">https://stackoverflow.com/questions/420 ... -sql-azure</a>

  • User Avatar
    0
    pankajmathur created

    Do you recommend any workaround or suggestion?

  • User Avatar
    0
    godrunner created

    @pankajmathur, you could trying temporarily bumping up the level is SQL Server service/performance. See if that makes any difference....

  • User Avatar
    0
    bbakermmc created

    Sorry, we dont use azure. We have our own SQL cluster.