Conversation
…f permissions - Replace FormattedStringValueExtracter.Extract with LastIndexOf in PermissionGrantCacheItem and ResourcePermissionGrantCacheItem to eliminate repeated string tokenization and object allocations on every cache key parse (~12,000 calls per request with 4000+ permissions) - Add fast-path in SimpleStateCheckerManager.InternalIsEnabledAsync to skip DI scope creation when both StateCheckers and GlobalStateCheckers are empty, avoiding thousands of unnecessary scope allocations - Optimize PermissionChecker.IsGrantedAsync(string[]) and ResourcePermissionChecker.IsGrantedAsync(string[], resourceName, resourceKey) to load all permission definitions once via GetPermissionsAsync / GetResourcePermissionsAsync instead of N individual GetOrNullAsync calls, and use batch StateCheckerManager.IsEnabledAsync for state checking - Optimize AbpApplicationConfigurationAppService.GetAuthConfigAsync to pre-load all permission names into a HashSet for O(1) lookup instead of N async GetOrNullAsync calls inside the loop - Fix GetResourcePermissionsAsync to deduplicate by (ResourceName, Name) instead of Name only, matching the actual uniqueness constraint of resource permissions defined in PermissionDefinitionContext Production impact (customer with 4000+ permissions): 10s+ -> ~682ms
d5509c6 to
67ebd58
Compare
EngincanV
approved these changes
Apr 10, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When a project has 4000+ permissions,
/api/abp/application-configurationtakes 10s+. Even with Redis caching it stays slow (~1.45s locally) because the bottleneck is in the application layer. A temporary patch reduced customer production time from 10s+ to ~682ms.Changes:
SimpleStateCheckerManager.InternalIsEnabledAsync: skipServiceProvider.CreateScope()when bothStateCheckersandGlobalStateCheckersare emptyPermissionChecker.IsGrantedAsync(string[])/ResourcePermissionChecker.IsGrantedAsync(string[], ...): load all permission definitions once viaGetPermissionsAsyncinstead of N individualGetOrNullAsynccalls; use batchStateCheckerManager.IsEnabledAsyncGetAuthConfigAsync: pre-load permission names into aHashSetfor O(1) lookup instead of N async calls in the loopGetResourcePermissionsAsync: fix deduplication key fromNameto(ResourceName, Name)— resource permissions are unique by both fields, same name can exist for different resources