从网络服务向客户端发送多个文件的最有效解决方案?
想知道社区对于从单个请求向 Web 服务传送多个文件的最有效(在 I/O 和速度方面)解决方案有何看法。客户端不是网络浏览器。
到目前为止我看到的选项:
- 创建 zip 存档并将其流回客户端。
- Base64 编码文件返回需要由客户端解码的字符串数组。
- 使用 Mime 多部分/相关并在迭代中为每个文件发送 Mime 标头,也可能流回客户端。
也许还有其他我没有考虑到的?
澄清:
假设文件可能有数十兆字节,内存约为 4G,但可能有其他进程和/或同时请求。
Wonder what the community says about the most efficient (in terms of I/O and speed) solution for delivering multiple files back from a single request to a webservice would be. The client is not a web browser.
The options I see so far:
- creating a zip archive and streaming it back to the client.
- base64 encoding files an returning array of strings that would need to be decoded by the client.
- Using Mime multipart/related and sending Mime headers for each file in iteration, also potentially streamed back to the client.
Maybe there are others I haven't considered?
CLARIFICATION:
Let's assume the files may be in the 10s of Megabytes, and that memory is around 4G but there are likely other processes and/or simultaneous requests.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为您需要考虑绑定(流)和传输协议(肥皂,休息)。平均文件有多大?
I think you need to consider the bindings (streaming) and transports protocols (SOAP, REST). How large is the average file?