Open Closed

Decreased performance after use redis cache #3457


User avatar
0
dev3.advantiss created

I tried to use redis, but I got to decrease performance Site works very slowly and all entities are cached. I do not need cache all entities. I created new project with ABP version 5.3.1 - redis works fine If I use local redis, site will work good I try to use redis in Azure and another machine - I have problems with performance...

I created simple project with redis. Redis test project

  • ABP Framework version: v4.3.3
  • UI type: Angular
  • DB provider: MongoDB
  • Tiered (MVC) or Identity Server Separated (Angular): yes
  • Exception message and stack trace:
2022-07-21 20:37:54.876 +03:00 [DBG] CORS request made for path: /api/abp/application-configuration from origin: http://localhost:4200 but was ignored because path was not for an allowed IdentityServer CORS endpoint
2022-07-21 20:37:54.876 +03:00 [INF] No CORS policy found for the specified request.
2022-07-21 20:37:54.882 +03:00 [INF] Executing endpoint 'Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.AbpApplicationConfigurationController.GetAsync (Volo.Abp.AspNetCore.Mvc)'
2022-07-21 20:37:54.889 +03:00 [INF] Route matched with {area = "abp", action = "Get", controller = "AbpApplicationConfiguration", page = ""}. Executing controller action with signature System.Threading.Tasks.Task`1[Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ApplicationConfigurationDto] GetAsync() on controller Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.AbpApplicationConfigurationController (Volo.Abp.AspNetCore.Mvc).
2022-07-21 20:37:54.926 +03:00 [INF] Executing AbpApplicationConfigurationAppService.GetAsync()...
2022-07-21 20:37:55.612 +03:00 [DBG] PermissionStore.GetCacheItemAsync: pn:U,pk:0dd8a970-4a2a-53fd-4117-39fcf9f8b8be,n:FeatureManagement.ManageHostFeatures,pn:U,pk:0dd8a970-4a2a-53fd-4117-39fcf9f8b8be,n:AbpIdentity.Roles,pn:U,pk:0dd8a970-4a2a-53fd-4117-39fcf9f8b8be,n:AbpIdentity.Roles.Create,pn:U,pk:0dd8a970-4a2a-53fd-4117-39fcf9f8b8be,n:AbpIdentity.Roles.Update,pn:U,pk:0dd8a970-4a2a...........................................................................d8a970-4a2a-53fd-4117-39fcf9f8b8be,n:Realtor.RealEstates.Create,pn:U,pk:0dd8a970-4a2a-53fd-4117-39fcf9f8b8be,n:Realtor.RealEstates.Edit,pn:U,pk:0dd8a970-4a2a-53fd-4117-39fcf9f8b8be,n:Realtor.RealEstates.Delete
2022-07-21 20:37:55.732 +03:00 [DBG] Getting not cache granted permissions from the repository for this provider name,key: U,0dd8a970-4a2a-53fd-4117-39fcf9f8b8be
2022-07-21 20:37:55.811 +03:00 [DBG] Setting the cache items. Count: 68
2022-07-21 20:37:55.890 +03:00 [DBG] Finished setting the cache items. Count: 68
2022-07-21 20:37:55.903 +03:00 [DBG] PermissionStore.GetCacheItemAsync: pn:R,pk:admin,n:FeatureManagement.ManageHostFeatures,pn:R,pk:admin,n:AbpIdentity.Ro..................................................tes.Edit,pn:R,pk:admin,n:Realtor.RealEstates.Delete
2022-07-21 20:37:55.961 +03:00 [DBG] Getting not cache granted permissions from the repository for this provider name,key: R,admin
2022-07-21 20:37:55.974 +03:00 [DBG] Setting the cache items. Count: 68
2022-07-21 20:37:56.047 +03:00 [DBG] Finished setting the cache items. Count: 68
2022-07-21 20:37:56.054 +03:00 [DBG] PermissionStore.GetCacheItemAsync: pn:C,pk:Realtor_App,n:AbpIdentity.UserLookup
2022-07-21 20:37:56.108 +03:00 [DBG] Not found in the cache: pn:C,pk:Realtor_App,n:AbpIdentity.UserLookup
2022-07-21 20:37:56.112 +03:00 [DBG] Getting all granted permissions from the repository for this provider name,key: C,Realtor_App
2022-07-21 20:37:56.123 +03:00 [DBG] Setting the cache items. Count: 77
2022-07-21 20:37:56.203 +03:00 [DBG] Finished setting the cache items. Count: 77
2022-07-21 20:37:56.218 +03:00 [INF] STOPWATCH ApplicationAuthConfigurationDto() - 1288
2022-07-21 20:37:56.221 +03:00 [INF] STOPWATCH GetFeaturesConfigAsync() - 1
2022-07-21 20:37:56.333 +03:00 [INF] STOPWATCH GetLocalizationConfigAsync() - PART 1 - 109
2022-07-21 20:38:04.545 +03:00 [DBG] Executing HealthCheck collector HostedService.
2022-07-21 20:38:04.547 +03:00 [INF] Start processing HTTP request GET "https://localhost:44358/health-status"
2022-07-21 20:38:04.547 +03:00 [INF] Sending HTTP request GET "https://localhost:44358/health-status"
2022-07-21 20:38:04.548 +03:00 [INF] Request starting HTTP/1.1 GET https://localhost:44358/health-status - -
2022-07-21 20:38:04.897 +03:00 [INF] Executing endpoint 'Health checks'
2022-07-21 20:38:04.906 +03:00 [INF] Executed endpoint 'Health checks'
2022-07-21 20:38:04.906 +03:00 [INF] Received HTTP response headers after 359.4587ms - 200
2022-07-21 20:38:04.906 +03:00 [INF] End processing HTTP request after 359.674ms - 200
2022-07-21 20:38:04.909 +03:00 [INF] Request finished HTTP/1.1 GET https://localhost:44358/health-status - - - 200 - application/json 360.9457ms
2022-07-21 20:38:04.910 +03:00 [DBG] HealthReportCollector - health report execution history saved.
2022-07-21 20:38:04.910 +03:00 [DBG] HealthReport history already exists and is in the same state, updating the values.
2022-07-21 20:38:04.911 +03:00 [DBG] HealthReportCollector has completed.
2022-07-21 20:38:04.911 +03:00 [DBG] HealthCheck collector HostedService executed successfully.
**2022-07-21 20:38:13.051 +03:00 [INF] STOPWATCH GetLocalizationConfigAsync() - PART 2 - 16718**
2022-07-21 20:38:13.058 +03:00 [INF] STOPWATCH GetLocalizationConfigAsync() - PART 3 - 6
2022-07-21 20:38:13.058 +03:00 [INF] STOPWATCH GetLocalizationConfigAsync() - 16834
2022-07-21 20:38:13.426 +03:00 [INF] STOPWATCH GetSettingConfigAsync() - 362
2022-07-21 20:38:13.838 +03:00 [INF] STOPWATCH GetAsync() - 18912
2022-07-21 20:38:13.838 +03:00 [INF] Executed AbpApplicationConfigurationAppService.GetAsync().
2022-07-21 20:38:13.852 +03:00 [INF] Executing ObjectResult, writing value of type 'Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ApplicationConfigurationDto'.
**2022-07-21 20:38:13.884 +03:00 [INF] Executed action Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.AbpApplicationConfigurationController.GetAsync (Volo.Abp.AspNetCore.Mvc) in 18994.6453ms**

I have insert AbpApplicationConfigurationAppService where I insert some STOPWATCHs I have got ~19sec for AbpApplicationConfigurationAppService.GetAsync() and all other queries for backend has more time.

Why is it appear? What can I do with this problem?

Best regards, Advantiss Inc


9 Answer(s)
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    Please make your repository Private first.

  • User Avatar
    0
    dev3.advantiss created

    Please make your repository Private first.

    I have changed repository to Private

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    If I use local redis, site will work good I try to use redis in Azure and another machine - I have problems with performance...

    hi

    It seems to be a network issue. please check the network status between the two computers(website and redis)

  • User Avatar
    0
    dev3.advantiss created

    If I use local redis, site will work good I try to use redis in Azure and another machine - I have problems with performance...

    hi

    It seems to be a network issue. please check the network status between the two computers(website and redis)

    I have tested connection with site to redis(used redis-benchmark) and I have same results on different points. I have good results for ABP version 5.3.3, but bad results for ABP version 4.3.3.

    In version 4.3.3 ABP caches all entities, but it does not need for me. Maybe in 4.3.3 does not work GetManyAsync and SetManyAsync functionality? I don't know.

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    There will be many optimizations in the new versions, if you can upgrade this is the best solution.

  • User Avatar
    0
    dev3.advantiss created

    hi

    There will be many optimizations in the new versions, if you can upgrade this is the best solution.

    Do you have any document for upgrade ABP version?

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    https://docs.abp.io/en/abp/latest/Migration-Guides/Index https://docs.abp.io/en/commercial/latest/migration-guides/index

  • User Avatar
    0
    dev3.advantiss created

    Hi

    I have upgrade ABP version to 5.3.3, and get same results as use 4.3.3 version. Maybe my setting for Redis are wrong... Could you review my code and find mistakes or problems?

    I added code for Redis in RealtorHttpApiHostModule private void ConfigureCache(ServiceConfigurationContext context)

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    I created new project with ABP version 5.3.1 - redis works fine

    Can you compare the code?

Made with ❤️ on ABP v9.1.0-preview. Updated on October 11, 2024, 07:13