You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Thai Tran <bu...@gmail.com> on 2013/11/13 03:54:22 UTC

Grid Pagination and Performance

Good morning everyone (it is morning here :D)

According to official documentation 
(http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/corelib/components/Grid.html), 
we only need to set the rowsPerPage to turn the pagination on without 
caring about the actual returned list 's size. Having said that, if the 
returned result contains millions of records, it will kill the server 
memory, IMO

According to the none-official document 
(http://jumpstart.doublenegative.com.au/jumpstart/examples/tables/griddatasources), 
we need to extends the GridDataSource in order to return the correct 
number of records from database to server

I am just wondering, why does the misleading first way appear in the 
official document ? Or I am missing sth?

Thai Tran



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Grid Pagination and Performance

Posted by Thiago H de Paula Figueiredo <th...@gmail.com>.
On Thu, 14 Nov 2013 00:33:04 -0200, Thai Tran <bu...@gmail.com> wrote:

> Thank all for your answers. What I am really confused is the official
> document does not say anything about the performance, while I can see
> clearly that in my persisted list, there is 10k objects transferred back
> and forth between client and server even the rowsPerPage is set to 20. I
> think there should be a warning there.

This will only happen if you fetch all objects instead of using a  
GridDataSource implementation, provided by Tapestry or written by you,  
that only fetches the object that will be shown. Grid itself doesn't fetch  
any data. It delegates it to the GriDataSource parameter, which is up to  
you to provide.

-- 
Thiago H. de Paula Figueiredo
Tapestry, Java and Hibernate consultant and developer
http://machina.com.br

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Grid Pagination and Performance

Posted by Lance Java <la...@googlemail.com>.
The Grid should only ever send a single page of data at a time.

Let's get things clear...  Are you using @Persist or java.util.List with
your large dataset? To maintain scalability you should never coerce
GridDataSource to List.

Perhaps it's just your choice of language (persist & list) that was
ambiguous or perhaps we've found your issue. I think some code might help
better explain what you're doing.

Re: Grid Pagination and Performance

Posted by Thai Tran <bu...@gmail.com>.
Thank all for your answers. What I am really confused is the official
document does not say anything about the performance, while I can see
clearly that in my persisted list, there is 10k objects transferred back
and forth between client and server even the rowsPerPage is set to 20. I
think there should be a warning there.


On Wed, Nov 13, 2013 at 9:54 AM, Thai Tran <bu...@gmail.com> wrote:

> Good morning everyone (it is morning here :D)
>
> According to official documentation (http://tapestry.apache.org/
> current/apidocs/org/apache/tapestry5/corelib/components/Grid.html), we
> only need to set the rowsPerPage to turn the pagination on without caring
> about the actual returned list 's size. Having said that, if the returned
> result contains millions of records, it will kill the server memory, IMO
>
> According to the none-official document (http://jumpstart.
> doublenegative.com.au/jumpstart/examples/tables/griddatasources), we need
> to extends the GridDataSource in order to return the correct number of
> records from database to server
>
> I am just wondering, why does the misleading first way appear in the
> official document ? Or I am missing sth?
>
> Thai Tran
>
>
>

Re: Grid Pagination and Performance

Posted by Thiago H de Paula Figueiredo <th...@gmail.com>.
On Wed, 13 Nov 2013 20:29:51 -0200, Lance Java <la...@googlemail.com>  
wrote:

> The grid needs the rowcount to know how many pages there are in total (eg
> page 1 of N). HibernateGridDataSource and JpaGridDataSource execute 2  
> types of queries. 1 to get the rowcount and another to get a single page  
> at a
> time. In my opinion this is a scalable approach.

Not to mention the queries can be cached, specially the row count one.

-- 
Thiago H. de Paula Figueiredo
Tapestry, Java and Hibernate consultant and developer
http://machina.com.br

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Grid Pagination and Performance

Posted by Lance Java <la...@googlemail.com>.
The grid needs the rowcount to know how many pages there are in total (eg
page 1 of N). HibernateGridDataSource and JpaGridDataSource execute 2 types
of queries. 1 to get the rowcount and another to get a single page at a
time. In my opinion this is a scalable approach.