On 9/5/11 12:46 PM, Emmanuel Lécharny wrote:
Forwarded this message to mina's ML.



1) the socket configuration is really important, more specifically the in and out buffers.>In your case, you should configure large buffers (I think the default is 4 kb, from the top>of my head).
Does the buffer size makes Mina to adjust the TCP packet length?

The default value is not 4k, it defaults to your system setting. You can force that using the setSendBufferSize() method :

( ( AbstractSocketSessionConfig ) acceptor.getSessionConfig() ).setSendBufferSize( 64 * 1024 );


3) what would be better is to use a dedicated socket to send the data to the
 remote peer (see FtpServer)
Is it really a good idea to open a dedicated socket for each client if
we have 1000+ clients?
Should not be an issue. Opening sockets is not costly, nor keeping them opened.


4) otherwise, if you decide to send the data in small chunks, then you have
 to deal with the MessageSent event

Talking about the 4th item, as soon as you wait to be waken up when the last chunk has been sent, then the thread will be available for other sessions.
Yes, but how to issue an asynchronous chunk send request and exit from
handling MessageSent event in IoHandlerAdapter + when chunk
successfully transmitted how to make Mina call again the method which
transfers the data to send the next chunk?
You will have to maintain a session variable which store the current state of your session. When you receive a request, you prepare the data you want to send, and split them in small chunks. Then you send the first chunk in the messageReceived() method, and all the others in the messageSent() method.

At least, this is how I would do that.


--
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com

Reply via email to