在 GWT 中将大型数组从服务器传输到客户端
我正在尝试使用异步 RPC 调用将大型二维数组 (17955 X 3) 从服务器传输到客户端。这需要很长的时间,这尤其糟糕,因为初始化应用程序需要数据。我读到使用 JSON 对象可能会更快,但我不确定如何在 Java 中进行转换,因为我对这门语言和 GWT 还很陌生,而且我不知道速度差异是否显着。我还在某处读到可以压缩数据,但我只在论坛中读到,我不确定这是否真的可能,因为我在其他地方找不到相关信息。有什么办法可以将大量数据从服务器传输到客户端吗?感谢您抽出时间。
I'm attempting to transfer a large two dimensional array (17955 X 3) from my server to the client using Asynchronous RPC calls. This is taking a very long period of time which is especially bad because the data is needed in order to initialize the application. I've read that using a JSON object might be faster, but I'm not sure how to do the conversion in Java as I'm pretty new to the language and GWT, and I don't know if the speed difference is significant. I also read somewhere that I can zip the data, but I only read that in a forum and I'm not sure if it's actually possible as I couldn't find information for it elsewhere. Is there any way to transfer large amounts of data from server to client? Thanks for your time.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
阅读这篇文章了解添加 JSON< /strong> GWT 功能。关于压缩本文解释了使用 GWT 进行 gzipping。
此外,即使使用 gzipping 实现压缩,数组的大小仍然非常大,这取决于数组中重复的数据量。如果可能的话,您可能需要考虑在多个 RPC 调用中逻辑地分解数组。
Read this article on adding JSON capabilities to GWT. In regards to compression this article explains gzipping with GWT.
Also the size of your array is still very large even with the compression you may achieve with gzipping, which will vary depending on how much data is repeated in your array. You may want to consider logically breaking up the array in multiple RPC calls if at all possible.
如果您的应用程序需要如此大量的数据来初始化,我建议您重新审视您的设计。
I would recommend revisiting your design if your application needs such a large amount of data to initialize.
正如其他人指出的那样,您应该重新考虑您的设计,因为即使您能够以某种方式解决数据传输速度问题,您也可能会发现其他问题在等着您
您可以考虑的是:
对数据进行分区:
您的用户将如何处理大量数据。您的用户可能需要某种用户界面帮助才能处理如此庞大的数据。如果您打算使用分页、选项卡或其他方式对数据进行分区以供用户使用,为什么不按需加载数据呢?例如,如果您使用分页网格,则可以加载单页记录;如果要使用选项卡,则可以加载单个选项卡的记录。类似地,如果您要允许对记录进行过滤,则可以在加载后设置默认过滤器以将数据保持在最小值。
汇总数据:
如果您不打算向用户显示每一行,您还可以汇总服务器上的数据。例如,您可以最初显示每组记录的摘要,并让用户深入查看特定组
As other's pointed out, you should re-consider your design because even if you are able to solve the data transfer speed issue somehow you will likely find other issues waiting for you:
What you can think about is:
Partitioning the data:
How is your user going to cope with a lot of data. Your user will probably need some kind of user interface aid to be able to work with such a huge data. If you are going to use paging, tabs or other means to partition the data for user's consumption, why not load the data on demand. For example, you can load a single page of records if you are using a paging grid or you can load a single tab worth of records if you are going to use tabs. Similary, if you are going to allow filtering on the records, you can set a default filter after the load to keep the data to a minumum.
Summarizing the data:
You can also summarize the data on the server, if you are not going to show each row to the user. For example you can initially show summary for each group of records and let the user drill-down in a specific group