In reference to this thread : https://abp.io/support/questions/9088/API-become-slow-after-enabling-Redis-server
I have overridden the AbpApplicationConfigurationAppService
and find the worst offender is : await GetAuthConfigAsync();
As it takes sometimes on intial call 8 seconds, on subsequent calls it get down to around 3 second, which is still have.
So in total GetAsync call takes, I am using local docker Redis and the CPU and others are all look very good, no pressure on the server and no physical network, can you please advise ?
3 Answer(s)
-
0
hi
How many policies of
abpPolicyNames
andotherPolicyNames
?Thanks.
-
0
We have around 190 permission in the [dbo].[AbpPermissions] table with 5 roles, we dont use explicitly claims , it is more users/roles/permissions structure .
-
0
190 permission
should be pretty quick. I think the issue still has to do with Redis.You can try to disable the cache in
PermissionStore
?using System.Linq; using System.Threading.Tasks; using Volo.Abp.Authorization.Permissions; using Volo.Abp.Caching; using Volo.Abp.DependencyInjection; using Volo.Abp.Domain.Repositories; namespace Volo.Abp.PermissionManagement; [Dependency(ReplaceServices = true)] [ExposeServices(typeof(IPermissionStore), typeof(PermissionStore), typeof(MyPermissionStore))] public class MyPermissionStore : PermissionStore { public MyPermissionStore( IPermissionGrantRepository permissionGrantRepository, IDistributedCache<PermissionGrantCacheItem> cache, IPermissionDefinitionManager permissionDefinitionManager) : base(permissionGrantRepository, cache, permissionDefinitionManager) { } public async override Task<bool> IsGrantedAsync(string name, string providerName, string providerKey) { using (PermissionGrantRepository.DisableTracking()) { var permissionGrant = await PermissionGrantRepository.FindAsync(name, providerName, providerKey); return permissionGrant != null; } } public async override Task<MultiplePermissionGrantResult> IsGrantedAsync(string[] names, string providerName, string providerKey) { Check.NotNullOrEmpty(names, nameof(names)); var result = new MultiplePermissionGrantResult(); if (names.Length == 1) { var name = names.First(); result.Result.Add(name, await IsGrantedAsync(names.First(), providerName, providerKey) ? PermissionGrantResult.Granted : PermissionGrantResult.Undefined); return result; } using (PermissionGrantRepository.DisableTracking()) { var permissionGrants = await PermissionGrantRepository.GetListAsync(names, providerName, providerKey); foreach (var name in names) { result.Result.Add(name, permissionGrants.Any(x => x.Name == name) ? PermissionGrantResult.Granted : PermissionGrantResult.Undefined); } return result; } } }