如何提高RichFaces ScrollableDataTable控件的性能?

时间:2021-07-07 03:25:25

First, a little background:

首先,一点背景:

I'm displaying a data set with 288 rows and 8 columns (2304 records) using a ScrollableDataTable and the performance leaves a lot to be desired. An AJAX request that rerenders the control takes nearly 20 seconds to complete, compared to 7 seconds when rendering the same data using a DataTable control.

我正在使用ScrollableDataTable显示包含288行和8列(2304条记录)的数据集,性能还有很多不足之处。重新启动控件的AJAX请求需要将近20秒才能完成,而使用DataTable控件渲染相同数据时需要7秒。

Metrics captured via Servlet filters and JavaScript show that virtually all of the processing time is spent on the client-side. Out of a 19.87 second request, 3.87 seconds is spent on the server... with less than .6 seconds spent querying and sorting the data.

通过Servlet过滤器和JavaScript捕获的度量标准表明,几乎所有的处理时间都花费在客户端。在19.87秒的请求中,在服务器上花费了3.87秒......用于查询和排序数据的时间少于0.6秒。

Switching to a DataTable control cuts the request, response, and render cycle down to 1/3 of what I'm seeing with the ScrollableDataTable, but also removes several important features.

切换到DataTable控件会将请求,响应和渲染周期缩短到我在ScrollableDataTable中看到的1/3,但也会删除几个重要的功能。

And now the question:

现在的问题是:

Has anyone else experienced performance issues with the ScrollableDataTable? What's the most efficient way to render large amounts of tabular data in JSF/RichFaces with pinned columns and two-axis scrolling?

有没有其他人遇到过ScrollableDataTable的性能问题?使用固定列和双轴滚动在JSF / RichFaces中呈现大量表格数据的最有效方法是什么?

Update:

We ended up writing a custom control. Full control over the rendered components and generated JavaScript allowed us achieve a response time comparable to the DataTable. I agree with Zack though - pagination is the correct answer.

我们最终编写了一个自定义控件。完全控制渲染的组件和生成的JavaScript允许我们实现与DataTable相当的响应时间。我同意扎克的看法 - 分页是正确的答案。

3 个解决方案

#1


1  

The bottleneck is most likely in the "Render Response" phase of the JSF lifecycle. It's trying to render too many components for the view at one time.

瓶颈最有可能出现在JSF生命周期的“渲染响应”阶段。它试图一次为视图渲染太多组件。

My suggestion is to use pagination. It should significantly increase your performance because it's rendering smaller portions of the view at a time.

我的建议是使用分页。它应该会显着提高您的性能,因为它一次渲染视图的较小部分。

Be sure that your rich:dataTable has the rows property set and also -- if you are doing any column filtering -- make sure that the date table also has the property reRender="paginator" where paginator is your rich:datascroller.

确保您的rich:dataTable设置了rows属性,并且 - 如果您正在进行任何列过滤 - 请确保日期表还具有属性reRender =“paginator”,其中paginator是您的rich:datascroller。

#2


0  

I had similar problems a long time ago and ended up writing an applet to display the data that interacted with the page using livescript. My performance problems were the same as what you were seeing. The client took over 30 seconds to render the table data, and the server turned my response around in less than 2 seconds.

我很久以前遇到过类似的问题,最后编写了一个applet来显示使用livescript与页面交互的数据。我的表现问题与你所看到的一样。客户端花了30多秒来渲染表数据,服务器在不到2秒的时间内完成了我的响应。

#3


0  

This sounds like a bug in the javascript produced to render the table. Have you tried the page in different browsers? Which JSF implementation are you using (RI or MyFaces or something else)?

这听起来像是为了呈现表而生成的javascript中的错误。您是否在不同的浏览器中尝试过该页面?您使用哪种JSF实现(RI或MyFaces或其他)?

#1


1  

The bottleneck is most likely in the "Render Response" phase of the JSF lifecycle. It's trying to render too many components for the view at one time.

瓶颈最有可能出现在JSF生命周期的“渲染响应”阶段。它试图一次为视图渲染太多组件。

My suggestion is to use pagination. It should significantly increase your performance because it's rendering smaller portions of the view at a time.

我的建议是使用分页。它应该会显着提高您的性能,因为它一次渲染视图的较小部分。

Be sure that your rich:dataTable has the rows property set and also -- if you are doing any column filtering -- make sure that the date table also has the property reRender="paginator" where paginator is your rich:datascroller.

确保您的rich:dataTable设置了rows属性,并且 - 如果您正在进行任何列过滤 - 请确保日期表还具有属性reRender =“paginator”,其中paginator是您的rich:datascroller。

#2


0  

I had similar problems a long time ago and ended up writing an applet to display the data that interacted with the page using livescript. My performance problems were the same as what you were seeing. The client took over 30 seconds to render the table data, and the server turned my response around in less than 2 seconds.

我很久以前遇到过类似的问题,最后编写了一个applet来显示使用livescript与页面交互的数据。我的表现问题与你所看到的一样。客户端花了30多秒来渲染表数据,服务器在不到2秒的时间内完成了我的响应。

#3


0  

This sounds like a bug in the javascript produced to render the table. Have you tried the page in different browsers? Which JSF implementation are you using (RI or MyFaces or something else)?

这听起来像是为了呈现表而生成的javascript中的错误。您是否在不同的浏览器中尝试过该页面?您使用哪种JSF实现(RI或MyFaces或其他)?