Datatable pagination : long APPLY_REQUEST_VALUES phase

Components, Ajax Framework, Utilities and More.
mask_hot
Posts: 34
Joined: 27 May 2011, 10:52

10 Jul 2012, 22:38

84 936 ms - 2 inv. com.sun.grizzly.util.AbstractThreadPool$Worker.run
98,5% - 84 690 ms - 1 inv. URL: /it-manager/pages/hotel/List.xhtml
98,5% - 84 690 ms - 1 inv. com.ocpsoft.pretty.PrettyFilter.doFilter
98,5% - 84 689 ms - 1 inv. javax.servlet.FilterChain.doFilter
98,1% - 84 395 ms - 1 inv. org.primefaces.component.datatable.DataTable.processDecodes
98,1% - 84 373 ms - 1 inv. org.primefaces.component.datatable.DataTableRenderer.decode
98,1% - 84 369 ms - 1 inv. org.primefaces.component.datatable.DataHelper.decodeFilters
71,6% - 61 589 ms - 859 010 inv. javax.el.ValueExpression.getValue
23,8% - 20 458 ms - 859 010 inv. com.zeroturnaround.javarebel.SDKReloaderImpl.checkAndReload
18,2% - 15 618 ms - 859 010 inv. com.zeroturnaround.javarebel.zz.checkAndSetAccessibility
10,3% - 8 884 ms - 859 010 inv. com.google.common.collect.MapMaker$ComputingMapAdapter.get
6,6% - 5 683 ms - 859 010 inv. com.zeroturnaround.javarebel.zz.isVersioned
1,2% - 1 045 ms - 859 010 inv. com.zeroturnaround.javarebel.oT.isActive
1,2% - 1 003 ms - 859 010 inv. com.zeroturnaround.javarebel.oT.isInvokeActive
0,8% - 673 ms - 171 802 inv. com.reservit.model.hotel.Hotel.getNbroom
0,8% - 660 ms - 171 802 inv. com.reservit.model.hotel.Hotel.getCountry
0,8% - 655 ms - 171 802 inv. com.reservit.model.hotel.Hotel.getHotelid
0,8% - 650 ms - 171 802 inv. com.reservit.model.hotel.Hotel.getName
0,8% - 649 ms - 171 802 inv. com.reservit.model.hotel.Hotel.getCity

0,7% - 602 ms - 2 577 030 inv. com.google.common.collect.EmptyImmutableSet.size
0,3% - 236 ms - 859 010 inv. org.zeroturnaround.javarebel.ReloaderFactory.getInstance

Another profiling :
wtf! why does it parse the whole table!?

mask_hot
Posts: 34
Joined: 27 May 2011, 10:52

11 Jul 2012, 19:14

So I made a test :
I inserted 30k records in a table of a local mysql database.

The more I have records in my table, longer is the time elapsed in APPLY REQUEST VALUES while paginating or selecting a row.

I must say that I was not expecting this. Maybe the sql request would have been longer but not.

mask_hot
Posts: 34
Joined: 27 May 2011, 10:52

12 Jul 2012, 01:01

So I continued my investigations :

If I remove the filterBy on columns, everything is ok and there is no lagging .
The issue is really here :

Code: Select all

public class DataTableRenderer extends DataRenderer {

    protected DataHelper dataHelper;

    public DataTableRenderer() {
        super();
        dataHelper = new DataHelper();
    }

    @Override
    public void decode(FacesContext context, UIComponent component) {
        DataTable table = (DataTable) component;
        boolean isSortRequest = table.isSortRequest(context);

        if(table.isDraggableColumns()) {
            table.syncColumnOrder();
        }
        
        if(table.isResizableColumns() && table.isColResizeRequest(context)) {
            table.syncColumnWidths();
        }
        
      [b]  if(table.isFilteringEnabled()) {
            dataHelper.decodeFilters(context, table);[/b]
            
            if(!isSortRequest && table.getValueExpression("sortBy") != null && !table.isLazyLoading()) {
                sort(context, table);
            }
        }

        if(table.isSelectionEnabled()) {
            dataHelper.decodeSelection(context, table);
        }

        if(isSortRequest) {
            dataHelper.decodeSortRequest(context, table);
        }

        decodeBehaviors(context, component);
    }
I really don't understand how it can access the whole db table and having no trace of it. Maybe some JPA proxy mystery...
Anyway, it's a really big issue for me. Is there already an issue created about it?

raziel
Posts: 48
Joined: 11 Feb 2010, 20:45

12 Jul 2012, 14:16

The more I have records in my table, longer is the time elapsed in APPLY REQUEST VALUES while paginating or selecting a row.
yeap, we are facing that too, could you create an issue with a simple example that reprodices that?


User avatar
optimus.prime
Prime
Posts: 17421
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

12 Jul 2012, 22:22

Can you try with 3.4?

mask_hot
Posts: 34
Joined: 27 May 2011, 10:52

13 Jul 2012, 00:20

optimus.prime wrote:Can you try with 3.4?
I'm trying.
First, the code is not retrocompatible :
javax.faces.FacesException: Data type should be java.util.List or javax.faces.model.ListDataModel instance to be sortable.
(I had to remove the sortBy in the datatable)

Second, the lazyDatModel is not autoloaded as in 3.3.1
(I had to add lazy="true" to the datatable)

Finally it worked well in 3.4-SNAPSHOT.

So I retried the working code in 3.3.1 and, oh surprise, it works well too!
In fact, the missing attribute lazy="true" was the issue.
In 3.4 if it is not present the data are not autoloaded so it's quite mandatory. But in 3.3.1, if you forget to add the lazy="true", the data are well loaded but there is the "bug" I found.

Post Reply
  • Information
  • Who is online

    Users browsing this forum: No registered users and 1 guest