RMI 和 Web 服务都使用套接字连接吗?

发布于 2024-08-12 05:25:57 字数 626 浏览 11 评论 0原文

在另一个问题中,我担心使用的网络服务需要五分钟才能完成。我正在考虑在这个用例中使用 RMI 而不是 Web 服务。

但归根结底,Web 服务和 RMI 是否都使用 TCP 套接字作为底层连接?是否有任何原因导致耗时 5 分钟的 Web 服务调用不如耗时相同时间的 RMI 请求稳定?

请注意,在我们的例子中,我们讨论的是内部应用程序通信。


更新:这个问题源于我担心我们会遇到连接中断或其他需要 3-5 分钟才能完成的网络服务问题。这种担心可能完全不合理 - 我的其他问题的回复者指出如果你同时控制客户端和服务器,你应该没问题。但我只是想更详细地了解为什么使用 Web 服务实现比使用 RMI 实现更不可能在 5 分钟的调用中断开连接。如果它们都依赖于套接字连接,那么这可能可以解释为什么没有区别......

In another question I was worried about using a web service that takes a five minutes to complete. I was thinking about using RMI instead of web services for this use case..

but at the end of the day, do both a web service and RMI use a TCP socket for the underlying connection? Is there any reason why a web service call taking 5 minutes is less stable than an RMI request taking the same time?

Note that in our case we are talking about internal apps communicating.


Update: This question stems from me worrying that we'd run into dropped connections or other issues with web services that take 3-5 minutes to complete. The worry maybe totally irrational - responders to my other question indicated you should be fine if you control both the client and the server. But I just wanted to understand in more detail why a dropped connection for a 5 minute call is no more likely using a web service implementation than an RMI implementation. If they both rely on socket connections than that might explain why there is no difference...

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

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

发布评论

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

评论(2

听,心雨的声音 2024-08-19 05:25:57

如果单个远程调用需要 5 分钟才能完成,则可能是因为实现该调用的操作很慢,而不是因为 Web 服务层本身很慢。如果您使用 RMI 重新包装该操作,它可能会同样慢。

仅当调用大量操作时,RMI 相对于 SOAP 的性能优势才会真正显现出来,而不是任何一项操作的速度,因为 RMI 比 SOAP 更高效。但它不会神奇地使缓慢的操作变得更快。

至于您关于套接字的问题,是的,当您深入了解时,RMI 和 SOAP 都使用套接字级协议(对于 RMI 来说是 IIOP 或 JRMP,对于 SOAP 来说是 HTTP)。但这与您的问题并不真正相关。

If a single remote call is taking 5 minutes to complete, then it's probably because the operation implementing that call is slow, not because the web service layer itself is slow. If you were to re-wrap the operation with RMI, it'll likely be just as slow.

The performance benefit of RMI over SOAP is only really going to be apparent when you have a large number of operations being called, rather than for the speed of any one operation, simply because RMI is more efficient than SOAP. But it won't magically make a slow operation go faster.

As for your question regarding sockets, yes, RMI and SOAP both use socket-level protocols when you go down far enough (IIOP or JRMP in the case of RMI, HTTP in the case of SOAP). That isn't really relevant to your problem, though.

箹锭⒈辈孓 2024-08-19 05:25:57

RMI 主要用于 JRMP(在纯 Java 上下文中)或 IIOP(在非 JVM 上下文中),而 SOAP 消息通常(但不限于)通过 HTTP 发送。所有这三种有线协议都使用 TCP/IP,因此在这方面,选择 RMI 相对于 Web 服务没有优势。

RMI is mostly used over JRMP (in pure Java context) or IIOP (in non-JVM context), while SOAP messages are usually (but not exclusively) sent over HTTP. All of these three wire protocols use TCP/IP, so in this regard there is no advantage of choosing RMI over a web service.

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