如何使用 Web 服务获取数据来提高 XtraReports 的性能?
我在使用 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我会给你一个你可能不想听到的答案。
设定期望。
报告通常很慢,因为它们必须翻阅大量数据。只是没有一个好的方法来解决它。但除此之外,我会执行以下操作:
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:
有没有办法可以对数据进行分区,即返回一小部分数据?
如果没有绝对要求同时返回所有数据,那么在从数据库读取、序列化和通过 Web 服务传输时,将数据分成更小的部分将会产生巨大的差异。
编辑:我已经删除了这个答案,因为你已经提到了分区。我现在正在取消删除它,也许它会作为讨论的起点有一些用处...
至于您关于如何使用分页的观点:我认为您在“显示接下来的 100 个结果”方面走在正确的轨道上“ 方法。我不知道XtraReport是如何工作的,以及它对数据源的要求是什么。我看到了 3 个问题:
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:
传输数据集是一个坏主意。 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.