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

Poor Performance in UpgradeUserNotificationEvent#updateUserNotificationEventActionRequired

    Details

      Description

      Description
      In UpgradeUserNotificationEvent#updateUserNotificationEventActionRequired, we fetch all of the userNotificationEvents in the database and update their actionRequired one with the value of their corresponding Notifications_UserNotificationEvent entry. As it is very likely that a production instance of Liferay Portal that uses the Notifications portlet will have millions or even tens of millions of entries in this table, this is very inefficient. The method can easily be refactored so that only two SQL queries have to be run to process everything at once.

      Steps to Reproduce
      1. Deploy Liferay Notifications Portlet version 2.0.5 (It must be version 2.0.5, I have reason to believe that version 2.0.6 will not work).
      2. Deploy the so-announcements-portlet from the liferay-plugins-ee repo (it shouldn't matter what version, as long as it's compatible with 6.2)
      3. Run the attached Groovy script to add 1000 users and then 1000 announcements entries to your database. The script should complete within 10 minutes; however, DO NOT SHUT DOWN YOUR PORTAL once the script completes. Instead, observe the size of the Notifications_UserNotificationEvent table. Its size should be steadily increasing. Wait until its size stops increasing - it should have about a million entries by this point.
      4. Once the size of your Notifications_UserNotificationEvent table is no longer increasing, shut down the portal.
      5. Upgrade to Liferay 7. Observe the time it takes to complete the com.liferay.notifications.web.internal.upgrade.v2_1_0.UpgradeUserNotificationEvent#updateUserNotificationEventActionRequired process.

      Expected Result: The com.liferay.notifications.web.internal.upgrade.v2_1_0.UpgradeUserNotificationEvent#updateUserNotificationEventActionRequired process completes within a few seconds.
      Actual Result: The com.liferay.notifications.web.internal.upgrade.v2_1_0.UpgradeUserNotificationEvent#updateUserNotificationEventActionRequired process takes about 10 minutes to run.

        Attachments

          Activity

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Days since last comment:
                2 years, 21 weeks, 4 days ago

                Packages

                Version Package
                7.0.0 DXP FP46
                7.0.6 CE GA7
                7.0.0 DXP SP8
                7.0.X
                7.1.0 M1
                7.1.X
                Master