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

Performance problem with the legacy calendar portlet

    Details

    • Type: Bug
    • Status: Closed
    • Resolution: Won't Fix
    • Affects Version/s: 6.1.20 EE GA2, 6.1.X EE
    • Fix Version/s: None
    • Component/s: Calendar, Performance
    • Labels:

      Description

      Whether a certain day has calendar events or not is determined in an inefficient way.

      In portal-web/docroot/html/portlet/calendar/summary.jspf there is a the following block of code.

      int maxDayOfMonth = selCal.getActualMaximum(Calendar.DATE);
      
      Set data = new HashSet();
      
      for (int i = 1; i <= maxDayOfMonth; i++) {
      	Calendar tempCal = (Calendar)selCal.clone();
      
      	tempCal.set(Calendar.MONTH, selMonth);
      	tempCal.set(Calendar.DATE, i);
      	tempCal.set(Calendar.YEAR, selYear);
      
      	boolean hasEvents = CalEventServiceUtil.hasEvents(scopeGroupId, tempCal, eventType);
      
      	if (hasEvents) {
      		data.add(new Integer(i));
      	}
      }
      

      Altough calendar events are cached per groupId by CalEventLocalUtil, if you have calendars on private pages of many users, for the 1st time many SELECT will be issued. The implementation of the hasEvent() method in CalEventLocalServiceImpl could be much more efficient at that.

      Steps to reproduce

      1) Set the following property

      hibernate.show_sql=true
      

      2) Place the Calendar portlet on a page
      3) Navigate on a separate browser tab to Control Panel / Server Admin and execute Clear content cached across the cluster.
      4) Go back to the calendar and click on tab Summary

      Observe that the following query will have been executed ~60 times. (Two queries for each day of the current month).

      SELECT CalEvent.eventId as eventId388_0_, CalEvent.uuid_ as uuid2_388_0_, CalEvent.groupId as groupId388_0_, CalEvent.companyId as companyId388_0_, CalEvent.userId as userId388_0_, CalEvent.userName as userName388_0_, CalEvent.createDate as createDate388_0_, CalEvent.modifiedDate as modified8_388_0_, CalEvent.title as title388_0_, CalEvent.description as descrip10_388_0_, CalEvent.location as location388_0_, CalEvent.startDate as startDate388_0_, CalEvent.endDate as endDate388_0_, CalEvent.durationHour as duratio14_388_0_, CalEvent.durationMinute as duratio15_388_0_, CalEvent.allDay as allDay388_0_, CalEvent.timeZoneSensitive as timeZon17_388_0_, CalEvent.type_ as type18_388_0_, CalEvent.repeating as repeating388_0_, CalEvent.recurrence as recurrence388_0_, CalEvent.remindBy as remindBy388_0_, CalEvent.firstReminder as firstRe22_388_0_, CalEvent.secondReminder as secondR23_388_0_ FROM CalEvent WHERE (groupId = ?) AND (startDate >= ?) AND (startDate <= ?) AND (timeZoneSensitive = ?) AND (repeating = ?)
      

      After the fix you should see only 2 of these queries.

        Attachments

          Activity

            People

            • Assignee:
              adam.brandizzi Adam Brandizzi
              Reporter:
              laszlo.csontos Laszlo Csontos (Inactive)
              Participants of an Issue:
              Recent user:
              Esther Sanz
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Days since last comment:
                5 years, 42 weeks, 4 days ago

                Packages

                Version Package