客户端-服务器通信的可扩展性; XML v 序列化二进制文件

发布于 2024-11-06 16:12:50 字数 459 浏览 2 评论 0原文

过去,我工作过的系统通常使用 XML 在客户端和服务器之间进行通信并传输结果集等。然而,我当前的项目只是将对象列表序列化为二进制文件并通过网络发送。

现在,我们的“传输对象”(由于缺乏更好的描述)可能会由于一堆新字段而开始增大。再加上理论上我们可以发送最多 100,000 个对象的列表,这让我开始想知道我们当前方法与使用 XML 的相对性能。

当我说“性能”时,我会考虑:

  • 通过线路发送的对象的大小以及所花费的
  • 时间 组装准备传输的对象所花费的
  • 时间 在 UI 中显示之前在另一端解析/反序列化所花费的时间

我的直觉是XML 可能会变得非常冗长,因此可能需要某种压缩...但我不太熟悉它如何针对序列化二进制文件进行扩展。对于哪种方法更具可扩展性是否存在普遍共识,或者我们是否正在进入“适合目的”的领域? :)

感谢您的任何建议。

干杯, 戴夫.

In the past, the systems I've worked on have generally used XML to communicate between the client and server and transfer result sets, etc. My current project however simply serializes a list of objects into a binary and sends that across the wire.

We're now coming to a point where our 'transfer objects' (for lack of a better description) could start growing in size due to a bunch of new fields. This, added to the fact that we could in theory have a list of anything up to 100,000 objects sent across, makes me begin to wonder about the relative performance of our current approach vs using XML.

When I say 'performance' I consider:

  • Size of objects being sent across the wire, and time taken
  • Time taken to assemble objects ready for transfer
  • Time taken to parse / deserialize on the other side before we display in the UI

My gut feel is that XML could get very verbose, so might need some kind of compression... but I'm not really familiar with how it scales against serialized binaries. Is there a general consensus on what sort of approach is more scalable, or are we getting into the realm of "fit for purpose" here? :)

Thanks for any advice.

Cheers,
Dave.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

小苏打饼 2024-11-13 16:12:50

我认为,一般来说,人们一致认为 XML 序列化相当冗长而且速度不是很快。

关于你的二进制序列化,由于我们不知道实现,所以很难判断。您当然可以自己进行一些性能比较。

另外,查看二进制协议的公开实现并了解它们如何针对 XML 执行可能会很有趣。
协议缓冲区节俭浮现在我的脑海中。

还要检查这些:
Thrift、Protocol Buffers、JSON、EJB 等的性能比较?

https://github.com/eishay/jvm-serializers/wiki/< /a>

I think, very generally speaking, there is some consensus that XML serialization is rather verbose and not very fast.

Regarding your binary serialization, since we don't know the implementation, it is kind of hard to judge. You could of course do some performance comparisons yourself.

Also, it might be interesting to look at publicly available implementations of binary protocols and see how they perfom against XML.
Protocol buffers and Thrift come to mind.

Also check these:
Performance comparison of Thrift, Protocol Buffers, JSON, EJB, other?

https://github.com/eishay/jvm-serializers/wiki/

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文