使用 Spring 的 RMI 速度很慢
我正在使用 RMI,我注意到它非常非常慢。对于一个简单的呼叫,大约需要 8-10 秒才能得到响应。这不是我调用的方法需要那么长时间。如果我使用 RMI 但将调用指向 127.0.0.1,则速度非常快(无论如何我调用的方法并不复杂)。
那么……原因可能是什么?我的下游足够快,远程机器的上游也足够快......并且远程机器不太忙于做其他事情。
我可能做错了什么吗?或者有什么东西可以稍微固定一下吗?
I'm using RMI and I noticed it's very, very slow. For a simple call it takes ~ 8-10 seconds to get a response. It's not the method I'm calling that takes that long. If I use RMI but point the call to 127.0.0.1, it's very fast (the method I'm calling is not sophisticated anyway).
So... what could be the reason? My downstream is fast enough, the remote machine's upstream is fast enough... and the remote machine is not too busy doing other things.
Anything I could have done wrong? Or anything to fasten it up a bit?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
远程计算机是否有 IPv6 (AAAA) DNS 记录?如果您没有 IPv6 连接,则在尝试与双栈(IPv4 和 IPv6)计算机通信时可能会遇到类似的延迟。首先尝试 IPv6,几秒钟后超时,将通过 IPv4 建立连接。
Does the remote machine have IPv6 (AAAA) DNS records? You can get a delay like that when trying to talk to a dual-stack (IPv4 & IPv6) machine if you don't have IPv6 connectivity. IPv6 will be tried first, then once it times out after a few seconds, the connection will be made over IPv4.
您是通过 DNS 引用远程计算机还是使用原始 IP 地址?也许让你慢下来的是解析 DNS 名称。
Are you referencing the remote machine via DNS or are you using raw IP addresses? Maybe what is slowing you down is resolving DNS names.
可能是您的防火墙或某些代理妨碍了。您是否获得了客户端和服务器上记录的方法调用的进入和退出时间戳?尝试使用 Wireshark 查看数据包,特别是 TCP
SYN ->确认-> SYN/ACK
握手。Could be your firewall, or some proxying getting in the way. Have you got the entry and exit timestamps of the method calls logged on both client and server? Try using Wireshark to look at the packets, in particular the TCP
SYN -> ACK -> SYN/ACK
handshake.