mina-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Antonio Rodriges <antonio....@gmail.com>
Subject Re: Fwd: Re: Apache Mina NioAcceptor
Date Mon, 05 Sep 2011 11:38:29 GMT
>>>  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.

Why is it better (separate sockets)? This scales well or performs well?

>>>  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.

One important feature: does this means that after issuing send (finish
messageReceived event) this thread becomes free and ready for event
for other sessions (returned to thread pool used by Exec Filter or
smth like this)?

-- 
Kind regards,
Antonio Rodriges

Mime
View raw message