How do I control the TCP_NODELAY setting for a Scala remote actor?
I'm using Scala remote executors, but the round trip time (even a trivial message) is 80ms, presumably due to the underlying socket not being disabled by the TCP / IP Nagle algorithm (also known as TCP_NODELAY) or at least something which is informing me by someone with some experience with Java RMI.
Everything I do in the client to get the remote actor link is
val server=select(Node("127.0.0.1",12111),'server)
Is there a way to get the underlying socket and call java.net.Socket.setTcpNoDelay()
on it?
source to share
If you need to call setTcpNoDelay () on the underlying Socket without changing your Scala source code, there are 2 ways to do it.
-
Implement your own SocketImplFactory: This solution sucks because you will need to implement your own SocketImpl, which is not trivial, and you can't just wrap an existing SocketImpl because it's not a public API. All I can say here is to blame him for who designed the SocketImplFactory in the first place.
-
Use AOP
By the way, I think the best way to solve this problem is to change the code of the Scala remote actor and send a patch.
source to share