Le 9/13/12 7:35 PM, Antonio Rodriges a écrit :
Ah, so you are multiplexing the sessions.
Just a question : why is it a problem to have many opened files ? Plus why
Since a client program may have dozens of threads each sending
queries. There can be thousands of Client Progams. This is simply
wasteful to have a session per thread.
Depends on your architecture. But I won't argue here, I can see where
you come from.
By a "thread" in my previous post I meant not NioAcceptor or smth
else, but a thread on Client Program (not Mina thread)
would you use one thread per session ? (if you do that, you'd better use
BIO, it's 30% faster).
No, a session may be served by several Mina threads.
What do you mean by BIO?
Blocking IO, ie plain normal sockets...
Now I see we must have separate sessions for each thread (at least for
some application parts). And even more: at least two sessions - one
for read the other is for write?
I think there is some misunderstanding here. When I mention Session, I mean
the IoSession instance associated with the connection. If your many clients
are using one single IoSession, then it's a different story.
As I mentioned above, several threads of a Client use single IoSession
in order not to create a connection personnally for each.
Ok.
At this point, I need a better description of what you are trying to do...
Another reason to have a single session for several threads (apart
from reducing the number of opened files) is to have more tight (and
simplified) control over the processing of requests. When we have a
single session we are sure we have one physical Client, thus the
planner might queue (and not process them in parallel giving an
opportunity to other Clients ) all requests coming from a single
Client (issued by its several threads that do not know about each
other). This also reduces the number of open/close connection events
since the number of Client threads is not fixed and quite dynamic.
Ok, I see.
--
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com