Skip to Main Content
Customer Feedback

We love feedback from you on our products and the problems in your daily work that you would like us to solve. Please describe the challenge you're encountering and your desired outcome. Be as detailed as possible.

For technical issues or bugs please head to Support or our Developer Community. You can assign up to 20 votes in total. Thank you for your feedback.

Status explanation: 'Future Consideration' = Continuing to collect further feedback, not planned at this time. 'Investigating' = Prioritized for deeper customer and feasibility investigations ahead of planning development.

Categories Roles and Security
Created by Guest
Created on Jan 12, 2024

SynchronizingRolesSecurityEntityProvider is slow when tblSynchedUser has many users

We are using an external identity provider for sign in for users on our site using OpenID Connect. When the user has successfully logged in, we sync the role claims via the ISynchronizingUserService like stated in the documentation( so they end up in the tblSynchedUser, tblSynchedUserRole and tblSynchedUserRelations tables. We have a lot of users (around 500 000) in production. When setting access rights ( it looks like the fetching of users is very slow. Searching for VirtualRoles, Roles, VisitorGroups and Applications is fast. But searching for Users takes over 6 seconds(see attachemnt searchentities.png). And it looks like the search takes the same amount of time for every pagination

I did some reflection of the code and it looks like the maxRows parameter passed from EPiServer.Cms.UI.Admin.AccessRights.Internal.SetAccessRightsController.SearchUsers does not end up all the way to the database. EPiServer.Security.SynchronizingRolesSecurityEntityProvider.SearchAsync calls EPiServer.Security.Internal.DefaultSynchronizedUsersRepository.FindUsersAsync which then calls EPiServer.DataAccess.Internal.SynchronizeUsersDB.FindUsersByNameAsync which ends up calling stored procedure netSynchedUserList with parameter MaxCount set to int.MaxValue. If I have not specified any search pattern this results in the query fetching all 500 000 users for every paging. Should this maybe be done a better way? Too me it looks like all users are fetched from the database every time and then filtered in EPiServer.Security.SynchronizingRolesSecurityEntityProvider.SearchAsync ToPagedResult(). EPiServer.Security.Internal.DefaultSynchronizedUsersRepository.FindAsync looks like takes care of this in a better way, it passes the pageIndex and pageSize so it only fetches the users it is supposed to show.