简体   繁体   中英

What is an efficient way to send large data over the wire?

I have a list of strings List<string> . Actually is a list of file paths. And I need to send it to a webservice. The list can contain huge count of items (1 000 - 10 000).

What would be the most efficient way to accomplish this? considering that the message payload will be quite high.

I am asking for ideas and principles, not code samples.

Thanks much.

For paths - firstly (or rather: lastly) gzip or deflate it. If large numbers of things are going to have common roots, nest that data perhaps?

ie so

/foo/bar/blap/a/b
/foo/bar/blap/c/d

becomes

/foo/bar/blap
 /a/b
 /c/d

Beyond that - the payload is going to far exceed any protocol overheads etc, so use whichever protocols etc make life simple for you.

just using compression. gzip or deflate stream. string compression ratio is very good.

如果您坚持使用某种通信协议,则可以考虑分块。

已经建议的结合放气技术的序列化是高效且可靠的。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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