views:

115

answers:

1

I'm using Scala's remote actors, but round-trip time (even of a trivial message) is 80ms, presumably due to underlying socket not having the TCP/IP Nagle algorithm disabled (also known as TCP_NODELAY), or at least that's what someone with some experience with Java RMI informs me.

All I'm doing in the client to get a link to the remote actor is

val server=select(Node("127.0.0.1",12111),'server)

Is there some way to get at the underlying socket and invoke java.net.Socket.setTcpNoDelay() on it ?

+3  A: 

If you need to call setTcpNoDelay() on the underlying Socket without modifying the Scala source code, there are 2 ways to do it.

  1. Implement your own SocketImplFactory: this solution sucks because you will need to implement your own SocketImpl which is not trivial and you can not just wrap the existing SocketImpl because it is not a public API. All I can say here is blame it on whoever designed SocketImplFactory in the first place.

  2. Use AOP

BTW, I think the best way to solve this problem is to modify the Scala remote actor code and submit the patch.

Walter Chang