如何使用 Web 服务获取数据来提高 XtraReports 的性能?

发布于 2024-08-04 06:38:28 字数 635 浏览 6 评论 0原文

我在使用 XtraReports 工具和有关性能的 Web 服务时面临潜在问题。在 Windows 窗体应用程序中。

我知道 XtraReport 通过加载第一页来加载大型数据集(我将大型数据集理解为 +10,000 行),然后继续在后台加载其余页面,但这一切都是通过手中的数据源完成的。那么,如果该数据源必须通过 Web 服务(该服务需要序列化数据才能将其发送到客户端),会发生什么情况呢?

场景如下:

我有一个 Windows 窗体的瘦客户端,它调用 Web 服务,该服务接受该调用并通过反射实例化相应的类并调用所需的方法(请注意,此体系结构是继承的,我几乎已经对此别无选择,我必须使用它)。因此,我将有一个类从数据库获取数据并通过 Web 服务接口将其发送到客户端。这些数据可以是DataSet、SqlDataReader(另请注意,我们使用的是SQL Server 2000,但年底可能是2008年)、DataTable、XML等。

如果结果数据集很大,则序列化+传输时间可能会相当长,然后渲染报表可能会增加一些时间,从而降低整体性能。

我知道有可能使用流视频之类的东西,但是可以通过网络服务流数据,但我没有关于尝试周围的东西的线索信息。

您对此有何看法?请告诉我您可能有的任何问题,或者我是否需要编写更多信息以更好地说明问题。

谢谢!

I'm facing a potential problem using the XtraReports tool and a web service about performance. in a Windows Form app.

I know XtraReport loads large data set (I understand a large data set as +10,000 rows) by loading the first pages and then continue loading the rest of the pages in the background, but all this is done with a data source in hand. So what happens if this data source has to pass through a web service, which will need to serialize the data in order to send it to the client?

The scenario is the following:

I have a thin client in windows form that makes calls to a web service, which takes that call and by reflection instantiates the corresponding class and calls the required method (Please notice that this architecture is inherited, I have almost no choice on this, I have to use it). So I'll have a class that gets the data from the database and send it to the client through the web service interface. This data can be a DataSet, SqlDataReader (also notice that we're using SQL Server 2000, but could be 2008 by the end of the year), DataTable, XML, etc.

If the result data set is large, the serialization + transference time can be considerable, and then render the report can add some more time, degradating the overall performance.

I know that there is a possibility for using something like streaming video, but for streaming data through a web service but I have no lead info for trying something around it.

What do you think about this? Please let me know any questions you may have or if I need to write more info for better statement of the problem.

Thanks!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

弥繁 2024-08-11 06:38:28

我会给你一个你可能不想听到的答案。

设定期望

报告通常很慢,因为它们必须翻阅大量数据。只是没有一个好的方法来解决它。但除此之外,我会执行以下操作:

  1. 将数据加载序列化为二进制状态,转换为可通过soap(例如base64)传输的内容并传输它。这样你就可以避免很多无用的尖括号。
  2. 在客户端上预缓存尽可能多的数据。
  3. 关注应用程序的感知性能。例如,将收集的报告数据放到后台线程中,以便用户可以去做其他工作,然后在报告可用时向用户显示通知。
  4. 有时,可以提前生成最常用标准的报告,并在询问时提供该报告。

I'll give you an answer you probably don't want to hear.

Set expectations.

Reports are typically slow because they have to churn through a lot of data. There just isn't a good way to get around it. But barring that, I'd do the following:

  1. Serialize the data load to a binary state, convert to something transferable via soap (base64 for instance) and transfer that. This way you'll avoid a lot of useless angle brackets.
  2. Precache as much data on the client as possible.
  3. Focus on the perceived performance of the application. For instance, throw the report data gathering onto a background thread, so the user can go and do other work, then show the user a notification when the report is available.
  4. Sometimes, it is possible to generate the report for the most often used criteria ahead of time and provide that when asked.
雪花飘飘的天空 2024-08-11 06:38:28

有没有办法可以对数据进行分区,即返回一小部分数据?

如果没有绝对要求同时返回所有数据,那么在从数据库读取、序列化和通过 Web 服务传输时,将数据分成更小的部分将会产生巨大的差异。

编辑:我已经删除了这个答案,因为你已经提到了分区。我现在正在取消删除它,也许它会作为讨论的起点有一些用处...

至于您关于如何使用分页的观点:我认为您在“显示接下来的 100 个结果”方面走在正确的轨道上“ 方法。我不知道XtraReport是如何工作的,以及它对数据源的要求是什么。我看到了 3 个问题:

  • 服务器对分区数据的支持(例如,您的 Web 服务应该支持仅返回“第 3 页”的数据
  • 摘要数据 - 您的报告是否有一行总计或平均值?这些是由 XtraReport 控件计算的吗?它需要完整的数据集来显示这些结果吗?您可以自己向控件提供摘要(并找到一种更有效的方法来计算它们而不返回整个数据集吗?)
  • XtraReport 支持使用分页的数据源。

Is there a way you can partition the data, ie return a small subset of it?

If there's no absolute requirement to return all the data at the same time, then dividing up the data into smaller pieces will make a huge difference when reading from the database, serializing, and transporting through the webservice.

Edit: I had deleted this answer since you already mentioned partitioning. I'm undeleting it now, maybe it will serve some use as the starting point of a discussion...

As for your point about how to work with paging: I think you're on the right track with the "Show next 100 results" approach. I don't know how XtraReport works, and what its requirements for a datasource are. There are 3 issues I see:

  • Server support for partitioned data (eg your webservice should support returning just "page 3"'s data
  • Summary Data - does your report have a row of totals or averages? Are those calculated by the XtraReport control? Does it require a complete dataset to display those results? Can you provide the summaries to the control on your own (and find a more efficient way to calculate them without returning the entire data set?)
  • XtraReport support for a datasource that uses paging.
乖乖兔^ω^ 2024-08-11 06:38:28

传输数据集是一个坏主意。 DataSet 有很多无用的日期。使用简单的对象。在服务器端使用 ORM。
您还可以预先计算一些数据。引用可以缓存在客户端上,然后与服务器数据连接。

transfering DataSets is a bad idea. DataSet have a lot of unusefull date. Use Simple Objects. Use ORM on server side.
Also you can precalculte some data. Referencies can be cached on client and then joined with server data.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文