RMI using Spring is slow
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 doi开发者_开发知识库ng other things.
Anything I could have done wrong? Or anything to fasten it up a bit?
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.
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.
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.
精彩评论