Open Closed

/AbpUserConfiguration/GetAll lasts more than 1 minute. #7006


0
hsudas created

We have a very serious issue with Asp.net zero framework. Our application delays about 1 minute during first initialization because of /AbpUserConfiguration/GetAll service call. I attached the screenshot, please take a look and reply to us with a solution. Thanks. Royal_Trade_Management_Suite.png


8 Answer(s)
  • 0
    maliming created

    It's very fast when you call it the second time. Is it?

  • 0
    hsudas created

    Yes, second time it's faster. But first time extremely slow.

  • 0
    maliming created

    As far as I know, the aspnet application starts very slowly for the first time. Of course, it depends on the initialization content of your application when starting up. It includes the hardware configuration of the virtual machine..

    The general solution is:

    1. After launching the application, warm up before the user visits.
    2. Whenever possible, initialize some components during application execution, not when starting up.

    Of course, there may be other solutions, because Zero is a big project, so the startup speed is relatively slower.

    You can google to find other solutions that suit you.

    I think warm up is the easiest way.

  • 0
    maliming created

    Sorry, my main point is that the application is slow to start for the first time. This is unavoidable.

    Is it so slow to start your application for the first time in a local environment?

    Have you tried the Demo project? Whether it will start for the first time will be very slow.

  • 0
    maliming created

    90 seconds is definitely not normal.

    Have you tried the Demo project? Will it be so slow when it is first started?

    Is it convenient to send the project source code to us? support@aspnetzero.com

  • 0
    hikalkan created

    @hsudas:

    We are using lots of enterprise web applications and frameworks none of them are waiting like yours during the initialization (90 seconds!) .

    Sure, that's not normal. And a lot of enterprise companies are building application with the ABP framework and they don't have this slowness problem. It is a specific case with yours solution and I guess it is not related to our framework.

    As I see that you have sent the source code, thanks. We will check your project to undertstand the actual problem.

  • 0
    hikalkan created

    Hi,

    I had no Postgresql, but installed locally & created database using update-database. I got an error (will share at the end of this post), however it worked. I think the migrations after this error don't effect the AbpUserConfiguration/GetAll request.

    Anyway, this is the result:

    image.png

    It returned in 0.6 second in first run. Notice that I used a local Postgresql instance. But your application were using a remote one on amazon aws. Maybe problem is related to that. You may try to create an empty project (withot ABP) and create a connection and perform a query to see it.

    So, could not repeat the problem. If you share your AWS db connection info, I can test with it too.

    BTW, this is the migration error. I think you should fix this problem, otherwise you will have issues when you want to re-create your database:

    PM> update-database
    Applying migration '20181107154701_Initial_Migration'.
    Applying migration '20181107170215_Added_Warehouse'.
    Applying migration '20181107170503_Added_StockStatus'.
    Applying migration '20181206170121_Added_SkuMain'.
    Applying migration '20181206171942_Added_FulfillmentBy'.
    Applying migration '20181206173221_Added_ShippingTemplate'.
    Applying migration '20181206190113_Added_Vendor'.
    Applying migration '20181206193342_Regenerated_SkuMain4563'.
    Applying migration '20181206193522_Regenerated_SkuMain3808'.
    Applying migration '20181206205612_Regenerated_SkuMain5557'.
    Applying migration '20181207124115_Regenerated_SkuMain5029'.
    Applying migration '20181207132707_Regenerated_SkuMain7340'.
    Applying migration '20181207135558_Added_SkuQuantity'.
    Applying migration '20181207140215_Regenerated_SkuQuantity5460'.
    Applying migration '20181207142840_Added_PriceProfile'.
    Applying migration '20181207143840_Added_SkuPrice'.
    Applying migration '20181207145537_Regenerated_SkuPrice3977'.
    Applying migration '20181207150319_Regenerated_SkuPrice1037'.
    Applying migration '20181207185742_Added_SkuDetail'.
    Applying migration '20181208145903_Regenerated_SkuQuantity7391'.
    Applying migration '20181208163037_Regenerated_SkuQuantity8899'.
    Applying migration '20181211155317_Regenerated_SkuPrice7031'.
    Applying migration '20181211161050_Regenerated_SkuPrice9299'.
    Applying migration '20181211173901_Regenerated_SkuDetail2605'.
    Applying migration '20181211200004_Added_AsinMain'.
    Applying migration '20181212154340_Regenerated_ShippingTemplate9005'.
    Applying migration '20181212154619_Regenerated_ShippingTemplate7260'.
    Applying migration '20181212160308_Regenerated_ShippingTemplate8840'.
    Applying migration '20181212161958_Regenerated_ShippingTemplate3759'.
    Applying migration '20181212204931_Regenerated_SkuQuantity4679'.
    Applying migration '20181212210414_Regenerated_SkuQuantity6672'.
    Applying migration '20181212210905_Regenerated_SkuDetail2991'.
    Applying migration '20181213132549_Regenerated_ShippingTemplate9894'.
    Applying migration '20190109200256_Added_AppQuery'.
    Applying migration '20190226141814_Regenerated_SkuDetail3096'.
    Applying migration '20190302115011_AmazonAsinExp'.
    Applying migration '20190302121945_UpdateAmazonAsin'.
    Applying migration '20190303011807_AfterRecreateStockSummary'.
    Applying migration '20190303012441_Experiment'.
    Applying migration '20190304152845_AppQueryRegenerate'.
    Failed executing DbCommand (4ms) [Parameters=[], CommandType='Text', CommandTimeout='100']
    CREATE TABLE "AppQuery" (
        "Id" serial NOT NULL,
        "TenantId" integer NULL,
        "QueryName" character varying(50) NOT NULL,
        "QueryText" text NOT NULL,
        "QueryType" integer NOT NULL,
        "Status" integer NOT NULL,
        CONSTRAINT "PK_AppQuery" PRIMARY KEY ("Id")
    );
    Npgsql.PostgresException (0x80004005): 42P07: relation "AppQuery" already exists
       at Npgsql.NpgsqlConnector.<>c__DisplayClass161_0.<<ReadMessage>g__ReadMessageLong|0>d.MoveNext()
    --- End of stack trace from previous location where exception was thrown ---
       at Npgsql.NpgsqlConnector.<>c__DisplayClass161_0.<<ReadMessage>g__ReadMessageLong|0>d.MoveNext() in C:\projects\npgsql\src\Npgsql\NpgsqlConnector.cs:line 1032
    --- End of stack trace from previous location where exception was thrown ---
       at Npgsql.NpgsqlDataReader.NextResult(Boolean async, Boolean isConsuming) in C:\projects\npgsql\src\Npgsql\NpgsqlDataReader.cs:line 467
       at Npgsql.NpgsqlDataReader.NextResult() in C:\projects\npgsql\src\Npgsql\NpgsqlDataReader.cs:line 332
       at Npgsql.NpgsqlCommand.ExecuteDbDataReader(CommandBehavior behavior, Boolean async, CancellationToken cancellationToken) in C:\projects\npgsql\src\Npgsql\NpgsqlCommand.cs:line 1219
       at Npgsql.NpgsqlCommand.ExecuteNonQuery(Boolean async, CancellationToken cancellationToken) in C:\projects\npgsql\src\Npgsql\NpgsqlCommand.cs:line 1042
       at Npgsql.NpgsqlCommand.ExecuteNonQuery() in C:\projects\npgsql\src\Npgsql\NpgsqlCommand.cs:line 1025
       at Microsoft.EntityFrameworkCore.Storage.Internal.RelationalCommand.Execute(IRelationalConnection connection, DbCommandMethod executeMethod, IReadOnlyDictionary`2 parameterValues)
       at Microsoft.EntityFrameworkCore.Storage.Internal.RelationalCommand.ExecuteNonQuery(IRelationalConnection connection, IReadOnlyDictionary`2 parameterValues)
       at Microsoft.EntityFrameworkCore.Migrations.Internal.MigrationCommandExecutor.ExecuteNonQuery(IEnumerable`1 migrationCommands, IRelationalConnection connection)
       at Microsoft.EntityFrameworkCore.Migrations.Internal.Migrator.Migrate(String targetMigration)
       at Microsoft.EntityFrameworkCore.Design.Internal.MigrationsOperations.UpdateDatabase(String targetMigration, String contextType)
       at Microsoft.EntityFrameworkCore.Design.OperationExecutor.OperationBase.Execute(Action action)
    42P07: relation "AppQuery" already exists
    PM> 
    
  • 0
    hikalkan created

    AbpUserConfiguration/GetAll basically performs some database queries. When you first run the application, it is the first code that connects to the database. So, if initial database connection is slow, its response can be slow.

    I found many problems when I search "aws postgresql slow first connection" on Google. Some examples are https://stackoverflow.com/questions/43121081/painfully-slow-connection-speed-from-local-machine-to-aws-rds-postgresql-databas and https://serverfault.com/questions/323356/postgres-connection-establishment-slow

    If you share your credentials with info@aspnetzero.com (with a temporary password and maybe a readonly user), we can test it.