mina version 2.0.4, thread model
Hi, I am new to Mina, and I have a question regarding the thread model. I am now using the Executor.newCachedThreadPool() Which as I understand manages the I/O processor threads. My question is, does the amount of live I/O processor threads match the amount of open sockets? For example: if I have two open sockets, each one has it's own I/O processor thread, or, Can a single thread handle the messageReceived events for example for both sockets, if the thread is not busy when the events arriving. Thanks in advance, Angela
Re: mina version 2.0.4, thread model
Le 2/12/12 12:58 PM, Asher, Angela a écrit : Hi, I am new to Mina, and I have a question regarding the thread model. I am now using the Executor.newCachedThreadPool() Which as I understand manages the I/O processor threads. My question is, does the amount of live I/O processor threads match the amount of open sockets? No. The ExecutorFilter is used to create a separate pool of threads when processing a message that has been already processed by one IoProcessor. You may have many IoProcessor already, and each session will be associated with one and only one IoProcessor. As one IoProcessor thus can handle many Sessions, it may be necessary to use another thread pool behind the IoProcessor to guarantee that a slow session will not block teh other sessions handled by the same IoProcessor. For example: if I have two open sockets, each one has it's own I/O processor thread, No. Two sockets may perfectly be handled by one single IoProcessor. But they can also be managed by two, it depends on how and when they have been opened. Currently the used algorightm to spread the newly crated sessions is a round robin mechanism. or, Can a single thread handle the messageReceived events for example for both sockets, if the thread is not busy when the events arriving. Yes. And it's likely to be the case. That also means that if one session is very long to process, then all the other sessions will be pending, waiting for this session to terminate its execution. Hope it helps. -- Regards, Cordialement, Emmanuel Lécharny www.iktek.com
RE: mina version 2.0.4, thread model
Thank you for the quick response. That helped. I have a following question, regarding your last answer. if one session is very long to process, is it possible to configure the thread pool to create a new thread on demand? That means that if a single thread can handle all the sockets, than only one thread will be created, but if the thread is too busy, it will create another thread ( or as much as needed ). Thanks, Angela -Original Message- From: Emmanuel Lécharny [mailto:elecha...@gmail.com] Sent: Sunday, February 12, 2012 5:24 PM To: dev@mina.apache.org Subject: Re: mina version 2.0.4, thread model Le 2/12/12 12:58 PM, Asher, Angela a écrit : Hi, I am new to Mina, and I have a question regarding the thread model. I am now using the Executor.newCachedThreadPool() Which as I understand manages the I/O processor threads. My question is, does the amount of live I/O processor threads match the amount of open sockets? No. The ExecutorFilter is used to create a separate pool of threads when processing a message that has been already processed by one IoProcessor. You may have many IoProcessor already, and each session will be associated with one and only one IoProcessor. As one IoProcessor thus can handle many Sessions, it may be necessary to use another thread pool behind the IoProcessor to guarantee that a slow session will not block teh other sessions handled by the same IoProcessor. For example: if I have two open sockets, each one has it's own I/O processor thread, No. Two sockets may perfectly be handled by one single IoProcessor. But they can also be managed by two, it depends on how and when they have been opened. Currently the used algorightm to spread the newly crated sessions is a round robin mechanism. or, Can a single thread handle the messageReceived events for example for both sockets, if the thread is not busy when the events arriving. Yes. And it's likely to be the case. That also means that if one session is very long to process, then all the other sessions will be pending, waiting for this session to terminate its execution. Hope it helps. -- Regards, Cordialement, Emmanuel Lécharny www.iktek.com
Re: mina version 2.0.4, thread model
Le 2/12/12 4:31 PM, Asher, Angela a écrit : Thank you for the quick response. That helped. I have a following question, regarding your last answer. if one session is very long to process, is it possible to configure the thread pool to create a new thread on demand? Use a ExecutorFilter to do that. -- Regards, Cordialement, Emmanuel Lécharny www.iktek.com
[jira] [Closed] (DIRMINA-887) mutil bind localAddress
[ https://issues.apache.org/jira/browse/DIRMINA-887?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] jinkai mao closed DIRMINA-887. -- OK mutil bind localAddress --- Key: DIRMINA-887 URL: https://issues.apache.org/jira/browse/DIRMINA-887 Project: MINA Issue Type: Bug Components: Core Affects Versions: 2.0.4 Reporter: jinkai mao Labels: bind, localAddress, mutil Fix For: 2.0.5 class : org.apache.mina.core.polling.AbstractPollingIoAcceptor Method:private void processHandles(IteratorH handles) throws Exception /** * This method will process new sessions for the Worker class. All * keys that have had their status updates as per the Selector.selectedKeys() * method will be processed here. Only keys that are ready to accept * connections are handled here. * p/ * Session objects are created by making new instances of SocketSessionImpl * and passing the session object to the SocketIoProcessor class. */ @SuppressWarnings(unchecked) private void processHandles(IteratorH handles) throws Exception { while (handles.hasNext()) { H handle = handles.next(); handles.remove(); // Associates a new created connection to a processor, // and get back a session S session = accept(processor, handle); if (session == null) { break; } initSession(session, null, null); // add the session to the SocketIoProcessor session.getProcessor().add(session); } } Question: break? continue? -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira