简体   繁体   English

如何从服务器向客户端发送大量数据集

[英]How to send Huge data sets to Client from Server

I have a Requirement to send Data from Server (Tomcat : Java Process, Odata API's) to Client (React Based)我需要将数据从服务器(Tomcat:Java 进程、Odata API)发送到客户端(基于 React)

Data can range from few KB's to Hundred's of MB (Say 700 MB) which is retrieved from DB : RedShift , Processed and Sent to Client.数据的范围可以从几 KB 到数百 MB(比如 700 MB),这些数据是从 DB 检索的:RedShift,已处理并发送到客户端。

There can be multiple clients accessing at the same time as well to keep more stress on the system.也可以有多个客户端同时访问,以增加系统压力。

We added Pagination so that data for that page alone is loaded, but we have a functionality to export complete data set in CSV format.我们添加了分页,以便单独加载该页面的数据,但我们具有以 CSV 格式导出完整数据集的功能。

Processing of all the data is consuming lot of memory and application's heap gets exhausted sometime, Increasing heap is not the solution expected, I want to know from Application side anything can be done to Optimize system resources.处理所有数据会消耗大量内存,应用程序的堆有时会耗尽,增加堆不是预期的解决方案,我想从应用程序方面知道可以做些什么来优化系统资源。

Kindly suggest what could be the best way to transfer data also whould like to see if there are any other kind of API(Streaming) which can help me here请建议什么可能是传输数据的最佳方式,也想看看是否有任何其他类型的 API(流)可以在这里帮助我

Can you change the integration between client and your system?你能改变客户端和你的系统之间的集成吗?

Something like: the client sends the request to export a CSV with a callback url in payload.类似于:客户端发送请求以在有效负载中使用回调 url 导出 CSV。 You put this request in a queue (rabbitmq).您将此请求放入队列 (rabbitmq)。 The queue consumer process the request, generate the CSV and put it in a temporary area (S3 or behind a NGINX).队列消费者处理请求,生成 CSV 并将其放入临时区域(S3 或 NGINX 后面)。 Then your consumer notifies the client in the callback url with then new url for the client to download de full CSV.然后,您的消费者在回调 url 中通知客户端,然后使用新的 url 供客户端下载完整的 CSV。

This way, the system that process the incoming requests don't use too much heap.这样,处理传入请求的系统不会使用太多堆。 You only need to scale the queue consumer, but it's more easy because the concurrency is your configuration of how many consumers are consuming the messages, not the incoming requests from the clients.您只需要扩展队列消费者,但它更容易,因为并发是您对有多少消费者正在消费消息的配置,而不是来自客户端的传入请求。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM