On Wed, Nov 25, 2009 at 12:46 PM, Tuure Laurinolli < [email protected]> wrote:
> Zvika Gart wrote: > > I wrote a simple client that connects to the server and pumps continuous >> data. >> Both client and server run on Amazon's EC2 on Debian Linux instances >> (64-bit, Java 1.6). Client is in Europe and server in USA. >> >> >> *The results:* >> Simple Java implementation - 5 Mbps >> MINA implementation - 750 Kbps >> >> Tried removing the setUseDirectBuffers lines; tried a simpler threading >> model by running the IoHandler on the IoProcessor threads... nothing helps >> - >> MINA is capped at 750 Kbps. >> What is going on here?! >> > > Some things that you might want to do (mostly independent of each other): > - Check what the receive buffer size is for the MINA version > - Check if changing receive buffer size in MINA change performance? > - NIO requires polling > - Write a simple pure NIO implementation to see if this might be a NIO > issue > - Check if there are some differences in the traffic (e.g. TCP ACK > patterns) > - Check what the MINA version and the simple version are doing - e.g. is > MINA version consuming lots of CPU? > - Check syscall patterns of the MINA version and try to see if something is > taking unreasonably long time (pure NIO implementation might be helpful > here) > - A simple single threaded NIO server implementation works fine, reaching the same throughput as the simple ServerSocket implementation. - All versions, including MINA, hardly take any CPU (1%) - As for the receive buffer size, this is where the implementations differ: the 2 simple implementations (simple NIO and ServerSocket) start at 43690 bytes but quickly reach a receive buffer of 2MB. MINA on the other hand is stuck with a receive buffer of 43728 bytes. When I configured a large receive buffer in MINA with acceptor.getDefaultConfig().getSessionConfig().setReceiveBufferSize(2097152); I see the server using a buffer of 131071 bytes for the client socket. This slightly improves performance but not anywhere close to that of the simple implementations. - As for syscall patterns, I'll need your help as I am a .NET programmer and not familiar with Java/Linux profiling...
