+1-888-365-2779
Try Now
More in this section

Forums / General Discussions / Avoiding returning all users from wrapped MembershipProvider

Avoiding returning all users from wrapped MembershipProvider

12 posts, 1 answered
  1. Thomas
    Thomas avatar
    2 posts
    Registered:
    02 May 2011
    17 May 2011
    Link to this post
    I have successfully setup a basic MembershipProvider and RoleProvider in a Sitefinity 4.1 site and have run into a potential issue.  Looking at the source code for MembershipProviderWrapper (provided in this thread: http://goo.gl/ahccK) and watching log outputs from my MembershipProvider it appears (though I hope I'm wrong) that a fairly routine operation in Sitefinity is retrieving all of the users in the system, dumping them into a list, and then returning this list deeper into the system as an IQueryable.  In my situation I have a over 100,000 users and I do not want to be pulling all of them out of the database and dumping them into a list when Sitefinity needs to do something.  Is there a way to avoid this issue?  Thanks!
  2. Lubomir Velkov
    Lubomir Velkov avatar
    688 posts
    Registered:
    03 Nov 2014
    18 May 2011
    Link to this post
    Hello Thomas,

    Yes, we are aware of this issue. Unfortunately currently our implementation does not allow another way to do that - we have to return all the records and convert the to an IQueryable interface, because our internal data structures rely on that. We plan to make an optimization in the future that will fix this problem but we are not sure when this optimization will be available. We are sorry for the inconvenience.

    Greetings,
    Lubomir Velkov
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
    Answered
  3. Eric
    Eric avatar
    147 posts
    Registered:
    12 Nov 2007
    18 May 2011
    Link to this post
    I'm looking at the source code and the only place it creates an IQueryable list is GetUsers, which is only used by Delete.

    Does GetUsers get called elsewhere, like via the website just by the nature of it it being a membership provider? Or are you referring to something else.

    Couldn't the Delete be changed to call GetUser(item.Id)?

    Eric
  4. Thomas
    Thomas avatar
    2 posts
    Registered:
    02 May 2011
    18 May 2011
    Link to this post
    Eric: GetUsers is indeed being called from deeper inside the Sitefinity code due to how MembershipProviders are handled.  I'm not sure precisely where the call is coming from, but via logs its clear that it's getting called quite a bit.

    Lubomir: Thanks for the info!
  5. Eric
    Eric avatar
    147 posts
    Registered:
    12 Nov 2007
    18 May 2011
    Link to this post
    Does the regular Sitefinity membership provider do this? If I have 100k users and the wrapper hurts performance, will the default provider be zippy?
  6. Lubomir Velkov
    Lubomir Velkov avatar
    688 posts
    Registered:
    03 Nov 2014
    19 May 2011
    Link to this post
    Hello Eric,

    In many places in our UserManager class we have calls like this:

    var user = prov.GetUsers().Where(u => u.UserName == username).FirstOrDefault();

    The regular Sitefinity provider doesn't do this, of course. The thing is the manager was written having in mind that only the regulard provider will be used. We then added the ASP.NET membership provider, which is not suited very well for this scenario so we had to improvise.

    We will have to revamp the module entirely in order to make any optimizations.

    Kind regards,
    Lubomir Velkov
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  7. Ariel Trellini
    Ariel Trellini avatar
    5 posts
    Registered:
    08 May 2006
    09 Aug 2013
    Link to this post
    I have the same problem. I defined a custom MembershipDataProvider that uses  REST web services to retrieve user information. So... it is not good to get all users (probablily hundred of thousands) from the web services in order to the UserManager filters them to match the username.
    Is there another option to do this?

    Regards, 
    Ariel
  8. Victor Velev
    Victor Velev avatar
    1345 posts
    Registered:
    06 Jul 2015
    14 Aug 2013
    Link to this post
    Hello Ariel,

    Can you provide us with a bit more information on what exactly you want to do with the users from the provider, because if you want to manage them through the backend, all the users will be required to be loaded. However, if you trying only to log them in, you will be take advantage of some of the optimizations that will be introduced with our future versions as we have made some modifications to the current implementation and the number of IQueriable lists that we use in regard to the user management.

    Regards,
    Victor Velev
    Telerik
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  9. Ariel Trellini
    Ariel Trellini avatar
    5 posts
    Registered:
    08 May 2006
    10 Feb 2014 in reply to Victor Velev
    Link to this post
    Hi Victor, 

    Sorry for the delay. We already solved this issue connecting our custom MembershipDataProvider with the users database. Thus, we could use Linq to use IQueriable. I don't like this solution, but it was the only one available in that moment.
    We only wanted to authenticate (log-in) and authorize (check roles) the users. We didn't want to manage users and roles from Sitefinity Backend. Additionaly, we want to show user's username, first and last name... but nothing more. If there are some new features to do that, I will appreciate your help.

    Regards, 
    Ariel.



  10. Yavor Slavchev
    Yavor Slavchev avatar
    27 posts
    Registered:
    13 Sep 2016
    11 Feb 2014
    Link to this post
    Hi,

    Currently, the UserManager in Sitefinity is returning all users as IQueryable<User>, so you will be able to filter this query and extract only the required users.

    As for the UI, where do you want to show just the user's username, first and last name? You could make a control template to show only these fields.

    Furthermore, could you please specify which version of Sitefiniity are you using?

    Regards,
    Yavor Slavchev
    Telerik
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
  11. Ariel Trellini
    Ariel Trellini avatar
    5 posts
    Registered:
    08 May 2006
    11 Feb 2014 in reply to Yavor Slavchev
    Link to this post
    Thanks for the quick response Yavor !

    We are using 6.1.4600.0 version and currently I'm moving our product to use 6.3.5000.0 version because we want to improve performance and Sitefinity's people recommended to us this new version. 

    Victor Velev told me this (see the post above): "if you trying only to log them in, you will be take advantage of some of the optimizations that will be introduced with our future versions as we have made some modifications to the current implementation and the number of IQueriable lists that we use in regard to the user management". Are those optimizations on version 6.3.5000?

    Regards, 
    Ariel.
  12. Yavor Slavchev
    Yavor Slavchev avatar
    27 posts
    Registered:
    13 Sep 2016
    14 Feb 2014
    Link to this post
    Hello Ariel,

    Let's take another approach. Let's focus on the specified issue.
    Please describe in details, step by step what you are trying to achieve and then what problems you have encountered.

    Regards,
    Yavor Slavchev
    Telerik
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
12 posts, 1 answered