针对 .NET 中大量内存数据生成报告的最有效方法是什么?
我正在开发一个项目,每月向数十万(如果不是数百万)客户发送账单。许多数据需要进行操作,包括通过内部 API 动态计算的数据。
现在,我的流程一次处理 2,500 张账单,并在每个范围完成时写出包含所有数据的 XML 文件。然后,我使用 Crystal Reports 报告该数据,这需要几分钟的时间。我正在寻找更好的方法来报告这些数据并需要一些建议。
Crystal 只是解析 XML 速度慢吗?我尝试将 Crystal 放入内存数据集,但似乎一旦我处理了 500 条左右的记录,XML 路由实际上更有效。我应该将数据写入 SQL 数据库并使用索引优化来报告吗?或者我是否缺少一种更快的替代方法?
I am working on a project that sends bills out to hundreds of thousands (if not millions) of customers each month. A lot of the data needs to be manipulated, with interest and whatnot dynamically calculated on the fly through an internal API.
Right now I have the process which works in chunks of 2,500 bills at a time and writes out an XML file containing all of the data when each range completes. I then use Crystal Reports to report on that data, which takes several minutes. I am looking for a better way to report of this data and need some advice.
Is Crystal just slow at parsing XML? I tried throwing Crystal an in-memory data set, but it seems that once I go over 500 records or so, the XML route is actually more efficient. Should I write the data out to our SQL database and report on it that way using index optimizations? Or am I missing an alternate approach that would be much faster?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
根据我的经验,Crystal Reports 在处理非常大的报告项目时速度很慢。
我发现其他一些报告解决方案往往可以更好地处理大型报告项目,特别是如果它们是根据内存数据集生成的。我建议尝试 Telerik 的报告工具。
In my experience, Crystal Reports is just slow on very large reporting projects.
I've found that some other reporting solutions tend to handle large reporting projects better, especially if they're generated off an in-memory dataset. I'd recommend trying Telerik's reporting tool for this.
您是否考虑过对报告进行多线程处理?或者使用多个服务器/服务来处理报告生成的子集。
我们使用 Crystal reports XI,发现它非常慢。此外,当来自单个服务的多线程时,Crystal 报表对您可以创建的线程报表的数量有限制。
我们使用 Sql Server 2005 中的 PdfSharp 和存储过程来运行我们的报告(比您的数据库要小,比如说大约 30 000 个报告)。这是一个非常耗时的过程。
因此,请查看多个服务/服务器作为生成子集的选项。
编辑
作为事后思考,我在 X 之前提出了 水晶问题 -)
Have you given thought to multi threading the reports? Or using multiple servers/services to handle subsets of the report generation.
We use Crystal reports XI, and have found it very slow. Also, when multi threading from a single service, Crystal reports have a limit to the number of threading reports you can create.
We run our reports (smaller than your baches, say about 30 000 reports) using PdfSharp and stored procedures, from Sql Server 2005. And this is a very time consuming process.
So have a look at multiple services/ servers as an option to generate the subsets.
EDIT
as an after thought, i have put out Crystal Question before X-)
我过去在 CR 上也遇到过同样的事情。当我遇到这个问题时,我将 XML 样式表的新开发切换为 HTML。它执行速度更快,但开发时间更长。
I ran into the same thing with CR in the past. When I hit that issue, I switched the new development to XML Stylesheets to HTML. It executed faster but took longer to develop.
就我个人而言,我发现 Crystal Reports 非常消耗内存,即使是很小的数据集也需要很长时间才能启动。我们也是用VS 2008为Win2K的用户开发的,所以就出现了版本冲突,因为VS 2008自带的CR版本只能在XP以上运行。
我最终将所有报告转换为序列化为 XML 的内存中对象,通过 XSL 转换为 HTML/CSS,并且可以使用 WebBrowser 控件进行打印。现在,一旦构建了 XML,我们的报告就会立即加载,而不是等待 Crystal 启动,这将查看时间从约 30 秒缩短到不到一秒,并将我们的 MSI 大小从约 27MB 降低到 1.5MB。
Personally, I found Crystal Reports to be a memory hog, taking a long time to start up for even small data sets. We also develop in VS 2008 for users using Win2K, so there was a version conflict, as the version of CR that comes with VS 2008 only works on XP or higher.
I wound up converting all of our reports to in-memory objects serialized to XML, which are translated via XSL to HTML/CSS, and can be printed using the WebBrowser control. Now our reports load as soon as the XML is built, rather than waiting for Crystal to start up, which dropped the viewing time from ~30 seconds to under a second, and dropped our MSI size from ~27MB to 1.5MB.