ICEfaces
  1. ICEfaces
  2. ICE-10880

ace:dataTable, optimize data loading in lazy mode

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: EE-3.3.0.GA, 4.0
    • Fix Version/s: EE-4.2.0.GA, EE-3.3.0.GA_P05
    • Component/s: ACE-Components
    • Labels:
      None
    • Environment:
      Any

      Description

      The ace:dataTable component is a very complex component with several features that have to be integrated together in elaborate ways to make everything work as seamlessly as possible. Some of these features, such as sorting and filtering, require the underlying model to be rebuilt at certain stages during a request, in order for them to work correctly. More specifically, the getValue() method of the component has to be called multiple times during a request for different purposes. Typically, the model has to be rebuilt 3-6 times during a request, whether in lazy mode or not.

      Because, in lazy mode, loading data can be an expensive operation on some applications, it would be beneficial for many users if the ace:dataTable component was more efficient in calling LazyDataModel.load(), thus optimizing its performance. This could be accomplished via a built-in caching system and/or with better logic to avoid rebuilding the model in certain cases. The purpose of this JIRA is to investigate the possibility of improving data loading performance in lazy mode and implementing an optimization that is feasible if possible.

        Activity

        Hide
        Arturo Zambrano added a comment - - edited

        r51530: fix to call the LazyDataModel load method only once during the render phase and once during the previous phases, unless it is a filter request

        Indeed, the load() method in LazyDataModel was being called multiple times during a lifecycle, five times or more in some cases. It was being called in every visitTree operation.

        This fix reduces the number of times the load() method is called to only two: one at the beginning of the lifecycle and one more when the component is ready to be rendered (it is necessary to be called again in the render phase because of any model updates and app changes that could've happened). This is the case for most requests, except for filtering requests, in which it is necessary to call the load() method a few more times to reflect the filtered data.

        Testing notes: please run all regression tests related to lazy loading. The change itself is not very visible, the only way to test it would be to add a println statement in the LazyDataModel.load() method and verify that it's only called twice per request (except for filtering requests).

        Show
        Arturo Zambrano added a comment - - edited r51530: fix to call the LazyDataModel load method only once during the render phase and once during the previous phases, unless it is a filter request Indeed, the load() method in LazyDataModel was being called multiple times during a lifecycle, five times or more in some cases. It was being called in every visitTree operation. This fix reduces the number of times the load() method is called to only two: one at the beginning of the lifecycle and one more when the component is ready to be rendered (it is necessary to be called again in the render phase because of any model updates and app changes that could've happened). This is the case for most requests, except for filtering requests, in which it is necessary to call the load() method a few more times to reflect the filtered data. Testing notes: please run all regression tests related to lazy loading. The change itself is not very visible, the only way to test it would be to add a println statement in the LazyDataModel.load() method and verify that it's only called twice per request (except for filtering requests).
        Hide
        Ken Fyten added a comment -

        Re-open to consider using a staged dataset for the filtering operations to further reduce the number of times this is called.

        Also to be backported to the 3.3 maintenance branch.

        Show
        Ken Fyten added a comment - Re-open to consider using a staged dataset for the filtering operations to further reduce the number of times this is called. Also to be backported to the 3.3 maintenance branch.
        Hide
        Arturo Zambrano added a comment - - edited

        r51573: modified approach to handle filtering requests in a special way, reducing the number of invocations of the load() method to only 2

        r51575: backported fix to the EE 3.3 maintenance branch

        Show
        Arturo Zambrano added a comment - - edited r51573: modified approach to handle filtering requests in a special way, reducing the number of invocations of the load() method to only 2 r51575: backported fix to the EE 3.3 maintenance branch
        Hide
        Liana Munroe added a comment -

        ICEfaces 4 trunk r51570. Verified non-filtered LazyDataModel.load() is only called twice per request.

        Show
        Liana Munroe added a comment - ICEfaces 4 trunk r51570. Verified non-filtered LazyDataModel.load() is only called twice per request.
        Hide
        Liana Munroe added a comment -

        ICEfaces 4 trunk r51575. Tested with dataTable filtering + lazy loading by modifying the LazyDataModel.load() method with a counter and using the showcase ace:dataTable > Lazy Loading demo. When entering input into a filter, LazyDataModel.load() is called twice. When removing input from the filter LazyDataModel.load() is called four times when the final (or only) character is removed from the filter.
        Is this an issue?

        Show
        Liana Munroe added a comment - ICEfaces 4 trunk r51575. Tested with dataTable filtering + lazy loading by modifying the LazyDataModel.load() method with a counter and using the showcase ace:dataTable > Lazy Loading demo. When entering input into a filter, LazyDataModel.load() is called twice. When removing input from the filter LazyDataModel.load() is called four times when the final (or only) character is removed from the filter. Is this an issue?
        Hide
        Liana Munroe added a comment -

        ICEfaces faces EE-3.3.0 maintenance branch r51577. Tomcat 8. When testing on EE-3.3.0 maintenance branch I am finding that the LazyDataModel.load() method is called 4 times in the lazyloading non-filter mode.

        Show
        Liana Munroe added a comment - ICEfaces faces EE-3.3.0 maintenance branch r51577. Tomcat 8. When testing on EE-3.3.0 maintenance branch I am finding that the LazyDataModel.load() method is called 4 times in the lazyloading non-filter mode.
        Hide
        Arturo Zambrano added a comment - - edited

        The issue in the 4 trunk is a more general issue with filtering. When deleting the last character, two separate filtering requests are made. This also happens in the non-lazy case. I'll create a separate JIRA for it.

        Show
        Arturo Zambrano added a comment - - edited The issue in the 4 trunk is a more general issue with filtering. When deleting the last character, two separate filtering requests are made. This also happens in the non-lazy case. I'll create a separate JIRA for it.
        Hide
        Arturo Zambrano added a comment -

        The double request issue in the 4 trunk was fixed under ICE-11327.

        Show
        Arturo Zambrano added a comment - The double request issue in the 4 trunk was fixed under ICE-11327 .
        Hide
        Arturo Zambrano added a comment -

        Closing this issue again. I couldn't reproduce the 4 invocations of the load() method on the EE 3.3 branch. I still get only 2. I tested on Tomcat 7 and 8, using the ace:dataTable > Lazy Loading demo. I tested filtering, sorting and pagination on that demo, and I get only 2 invocations in all cases. This was tested before backporting ICE-11327. Please check if you can still reproduce that issue and provide more specific steps to reproduce, if that's the case.

        Show
        Arturo Zambrano added a comment - Closing this issue again. I couldn't reproduce the 4 invocations of the load() method on the EE 3.3 branch. I still get only 2. I tested on Tomcat 7 and 8, using the ace:dataTable > Lazy Loading demo. I tested filtering, sorting and pagination on that demo, and I get only 2 invocations in all cases. This was tested before backporting ICE-11327 . Please check if you can still reproduce that issue and provide more specific steps to reproduce, if that's the case.
        Hide
        Liana Munroe added a comment -

        Verified can not reproduce 4 invocations of load() method ICEfaces EE-3.3.0 maintenance branch r51633 and 51694, Tomcat 8, IE11, FF 47, Chrome 59.

        Show
        Liana Munroe added a comment - Verified can not reproduce 4 invocations of load() method ICEfaces EE-3.3.0 maintenance branch r51633 and 51694, Tomcat 8, IE11, FF 47, Chrome 59.

          People

          • Assignee:
            Arturo Zambrano
            Reporter:
            Arturo Zambrano
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: