Starts in:
2 DAYS
15 HRS
8 MIN
34 SEC
Starts in:
2 D
15 H
8 M
34 S
Open Closed

Decreased performance after use redis cache #3386


User avatar
1
dev3.advantiss created

I have tried to use redis, but I got to decrease performance

  • 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-06 22:01:21.840 +03:00 [DBG] Executing AbpApplicationConfigurationAppService.GetAsync()...
2022-07-06 22:01:22.573 +03:00 [DBG] PermissionStore.GetCacheItemAsync: pn:U,pk:f164aa86-f536-867d-4c7f-3a049335a0ec,n:FeatureManagement.ManageHostFeatures,pn:U,pk:f164aa86-f536-867d-4c7f-3a049335a0ec,n:AbpIdentity.Roles,pn:U,pk:f164aa86-f536-867d-4c7f-3a........................................................
2022-07-06 22:01:22.651 +03:00 [DBG] Not found in the cache: pn:U,pk:f164aa86-f536-867d-4c7f-3a049335a0ec,n:FeatureManagement.ManageHostFeatures,pn:U,pk:f164aa86-f536-867d-4c7f-3a049335a0ec,n:AbpI..................................................................
2022-07-06 22:01:22.671 +03:00 [DBG] Getting not cache granted permissions from the repository for this provider name,key: U,f164aa86-f536-867d-4c7f-3a049335a0ec
2022-07-06 22:01:22.701 +03:00 [DBG] Setting the cache items. Count: 95
2022-07-06 22:01:22.798 +03:00 [DBG] Finished setting the cache items. Count: 95
2022-07-06 22:01:22.822 +03:00 [DBG] PermissionStore.GetCacheItemAsync: pn:R,pk:admin,n:FeatureManagement.ManageHostFeatures,pn:R,pk:admin,n:AbpIdentity.Roles,pn:R,pk:admin,n:AbpIdentity.Roles.Create,pn:R,pk:admin,n:AbpIdentity.Roles.Update,pn:R,pk:admin...................................................................
2022-07-06 22:01:22.876 +03:00 [DBG] Not found in the cache: pn:R,pk:admin,n:FeatureManagement.ManageHostFeatures,pn:R,pk:admin,n:AbpIdentity.Roles,pn:R,pk:admin,n:AbpIdentity.Roles.Create,pn:R,pk:admin,n:AbpIdentity.Roles.Update,pn:R,pk:admin,...........................................................
2022-07-06 22:01:22.898 +03:00 [DBG] Getting not cache granted permissions from the repository for this provider name,key: R,admin
2022-07-06 22:01:22.929 +03:00 [DBG] Setting the cache items. Count: 95
2022-07-06 22:01:23.011 +03:00 [DBG] Finished setting the cache items. Count: 95
2022-07-06 22:01:23.023 +03:00 [DBG] PermissionStore.GetCacheItemAsync: pn:C,pk:Dibl_App,n:AbpIdentity.UserLookup
2022-07-06 22:01:23.064 +03:00 [DBG] Not found in the cache: pn:C,pk:Dibl_App,n:AbpIdentity.UserLookup
2022-07-06 22:01:23.072 +03:00 [DBG] Getting all granted permissions from the repository for this provider name,key: C,Dibl_App
2022-07-06 22:01:23.086 +03:00 [DBG] Setting the cache items. Count: 104
2022-07-06 22:01:23.199 +03:00 [DBG] Finished setting the cache items. Count: 104
2022-07-06 22:01:23.227 +03:00 [DBG] STOPWATCH ApplicationAuthConfigurationDto() - 1381
2022-07-06 22:01:23.235 +03:00 [DBG] STOPWATCH GetFeaturesConfigAsync() - 2
2022-07-06 22:01:23.324 +03:00 [DBG] STOPWATCH GetLocalizationConfigAsync() - PART 1 - 84
2022-07-06 22:01:35.268 +03:00 [DBG] STOPWATCH GetLocalizationConfigAsync() - PART 2 - 11939
2022-07-06 22:01:35.276 +03:00 [DBG] STOPWATCH GetLocalizationConfigAsync() - PART 3 - 5
2022-07-06 22:01:35.279 +03:00 [DBG] STOPWATCH GetLocalizationConfigAsync() - 12039
2022-07-06 22:01:35.550 +03:00 [DBG] STOPWATCH GetSettingConfigAsync() - 262
2022-07-06 22:01:35.982 +03:00 [DBG] STOPWATCH GetAsync() - 14142
2022-07-06 22:01:35.985 +03:00 [DBG] Executed AbpApplicationConfigurationAppService.GetAsync().
* **Steps to reproduce the issue**:"
Enable redis...

After that:
AbpApplicationConfigurationAppService.GetAsync() is executed about 12+ sec
And this method is called every refresh page.
I added some Stopwatch and got such results:
2022-07-06 22:01:35.268 +03:00 [DBG] STOPWATCH GetLocalizationConfigAsync() - PART 2 - 11939

Why does reading localization resources take this time? What can I do with this problem?

If I disable redis I will get: STOPWATCH GetAsync() - 2069, and this method is called once.

from code:

stopWatch1.Start();

foreach (var resource in _localizationOptions.Resources.Values)
{
    var dictionary = new Dictionary<string, string>();

    var localizer = _serviceProvider.GetRequiredService(
        typeof(IStringLocalizer<>).MakeGenericType(resource.ResourceType)
    ) as IStringLocalizer;

    foreach (var localizedString in localizer.GetAllStrings())
    {
        dictionary[localizedString.Name] = localizedString.Value;
    }

    localizationConfig.Values[resource.ResourceName] = dictionary;
}

Logger.LogDebug("STOPWATCH GetLocalizationConfigAsync() - PART 2 - " + stopWatch1.ElapsedMilliseconds);

Best regards, Advantiss Inc


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

    hi

    Can you try the test code in the latest template?

    If still slow please share the project with me liming.ma@volosoft.com

  • User Avatar
    0
    dev3.advantiss created

    hi

    Can you try the test code in the latest template?

    If still slow please share the project with me liming.ma@volosoft.com

    Hi, I tried to create new project with using angular(from "https://abp.io/get-started"), but I have got error after "npm install" and "npm start": [error] Error: ENOENT: no such file or directory, lstat 'F:\Training\TestRedis1\angular\node_modules@swimlane' at Object.realpathSync (node:fs:2486:7) at resolveGlobalStyles (F:\Training\TestRedis1\angular\node_modules@angular-devkit\build-angular\src\webpack\configs\styles.js:60:31) at getStylesConfig (F:\Training\TestRedis1\angular\node_modules@angular-devkit\build-angular\src\webpack\configs\styles.js:92:70) at F:\Training\TestRedis1\angular\node_modules@angular-devkit\build-angular\src\builders\dev-server\index.js:137:43 at F:\Training\TestRedis1\angular\node_modules@angular-devkit\build-angular\src\utils\webpack-browser-config.js:76:16 at generateWebpackConfig (F:\Training\TestRedis1\angular\node_modules@angular-devkit\build-angular\src\utils\webpack-browser-config.js:65:40) at async generateBrowserWebpackConfigFromContext (F:\Training\TestRedis1\angular\node_modules@angular-devkit\build-angular\src\utils\webpack-browser-config.js:127:20) at async generateI18nBrowserWebpackConfigFromContext (F:\Training\TestRedis1\angular\node_modules@angular-devkit\build-angular\src\utils\webpack-browser-config.js:74:20) at async setup (F:\Training\TestRedis1\angular\node_modules@angular-devkit\build-angular\src\builders\dev-server\index.js:134:47)

    I installed @swimlane, but after that I have got another errors

    Error: node_modules/@abp/ng.theme.shared/node_modules/@swimlane/ngx-datatable/lib/services/scrollbar-helper.service.d.ts:12:26 - error TS2694: Namespace '"F:/Training/TestRedis1/angular/node_modules/@abp/ng.theme.shared/node_modules/@angular/core/core"' has no exported member 'ɵɵInjectableDeclaration'. 12 static ɵprov: ɵngcc0.ɵɵInjectableDeclaration<ScrollbarHelper>;

    Best regards, Advantiss Inc

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    Try running the yarn and yarn start

Made with ❤️ on ABP v9.1.0-preview. Updated on November 20, 2024, 13:06