Uploaded image for project: 'PUBLIC - Liferay Portal Community Edition'
  1. PUBLIC - Liferay Portal Community Edition
  2. LPS-40797

MySites portlet slows down portal greatly when there are huge user groups assigned to Sites



      The My Sites portlet slows down the portal severly when there are many users assigned to sites. For instance, we have seen the portal take 10 + seconds to load due to the My Sites portlet. This is because for every site that the portlet brings back, the database is queried for all of the user ID's associated. Below is the prepared statement that is run for every site returned in the portlet:

      SELECT DISTINCT User_.userId AS userId FROM User_ INNER JOIN Users_UserGroups ON (Users_UserGroups.userId = User_.userId) WHERE ((Users_UserGroups.userGroupId = @P0 ) ) AND (User_.companyId = @P1 ) AND (User_.defaultUser = @P2 ) AND ( (lower(User_.firstName) LIKE @P3 OR @P4 IS NULL) AND (lower(User_.middleName) LIKE @P5 OR @P6 IS NULL) AND (lower(User_.lastName) LIKE @P7 OR @P8 IS NULL) AND (lower(User_.screenName) LIKE @P9 OR @P10 IS NULL) AND (lower(User_.emailAddress) LIKE @P11 OR @P12 IS NULL) ) AND (User_.status = @P13 )

      Steps to reproduce this behavior:
      1. Create 30 Sites
      2. Create UsergroupA
      3. Assign 30,000 users to UsergroupA
      4. Add UsergroupA to 15 Sites
      5. See the portal slow down (takes 3-4 seconds for pages with the MySites portlet to load)
      6. Add UsergroupA to the other 15 Sites
      7. See the portal slow down even more (takes 8-10 seconds for pages with the MySites portlet to load). Pages without the MySites portlet do not take so long to load

      1. Employ the implementation of UserFinderImpl, specifically this method:

      public int countByC_FN_MN_LN_SN_EA_S(
      long companyId, String[] firstNames, String[] middleNames,
      String[] lastNames, String[] screenNames, String[] emailAddresses,
      int status, LinkedHashMap<String, Object> params,
      boolean andOperator)

      2. On the view.jsp in my_sites, there could be a much more efficient way to gather the members in groups with a single query, instead of calling the UserLocalServiceUtil for every row.




            shinn.lok Shinn Lok (Inactive)
            jonathan.mccann Jonathan McCann
            Participants of an Issue:
            Recent user:
            Marta Elicegui
            0 Vote for this issue
            1 Start watching this issue


              Days since last comment:
              8 years, 2 days ago


                Version Package
                6.2.0 CE RC3