Hi,
I'm currently experiencing some issue with MINA, I'm using it from the
scala language (which is definitely not the source of the problem).
When I send big amount of data through the network, the upload rate is
first high and then it slows down dramatically (I'm running the server
and the client on the same computer).
I believe it is due to bad usage of the library.
Did anyone experience a similar issue ? Does anyone can correct me if
I'm doing it wrong.
Here is how I encode message (this is scala, but it is still readable
for a java developer)
> val bufferSize = 200 * 1024 * 1024
> var buffer = IoBuffer.allocate( bufferSize , false )
> buffer.putInt( bufferSize - 4 )
> [...]
>
> buffer.flip()
> _session.write( buffer )
Here is how I decode messages
> def doDecode(session : IoSession, in : IoBuffer, out :
> ProtocolDecoderOutput) : Boolean = {
> log.info( "Decoding current buffer (size:{}ko)" , in.remaining()/1024 )
> if( in.prefixedDataAvailable(4) ) {
> log.debug( "Decoding started" )
> val remainingBytesToRead = in.getInt()
> val buffer = new Array[Byte]( _cmdSize )
> in.get( buffer )
> val cmd = new String( buffer , _utf8Charset )
>
> [...]
>
> true
> }
> else {
> false
> }
> }
Thanks,
Steve