Dear Emmanuel, Thank you so much for the answer; I have understood that Apache MINA is inherently multi-thread. Basically, it start (numbers of processor +1) thread. I have verified it with my application; however I am developing a storage service able to manage a large number of connections. I am thinking that this service will be deployed on a Grid of Processor. In my university there is a parallel computation system with about 548 core.My question is Apache MINA is able to use all the 548 core? If yes, how?
Thank you so much, best regards 2013/3/6 Emmanuel Lécharny [via Apache MINA] <[email protected]>: > Le 3/6/13 6:16 PM, IronMan a écrit : >> Hi, >> I want to develop a multithreading Client/Server Application using Apache >> MINA. >> I have find many examples for the single-thread case, but nothing for >> multithread. There is documentation for the multithread case? > > MINA allows you to design a multi-threaded server natively. In fact, it > *is* multi-threaded. > > There is nothing special you have to do to deal with multi-threaded > aspects, except to be sure that you have a thread-safe application. > > Let me explain how it works : > > 1) A client connects to the server : a thread is picked to process the > request. This thread will always be used for every request sent by this > client (unless you start playing with an executor in the middle of your > code) > 2) Once the server has received the request, and ha sprocessed it, it > can send back a rrsponse : this is done on the same thread > 3) And that's it. > > If you have a second client, it will use another thread. > > Ok, now, at some point, it's not anymore a One client/One thread > association. We have a limited number of threads available (default to > Nb processor +1), so when we reach the max number of thread, we reuse > the first thread (this is a round robin mechanism). > > So many clients can use the same thread. Still, this is safe as one > client won't be able to user the thread that is already used by another > client : it will be queued waiting for the previous client to be done. > > That's the way it works. Its an overly simplified explaination though. > You just have to give it a try, you'll see it works pretty well. > > -- > Regards, > Cordialement, > Emmanuel Lécharny > www.iktek.com > > > > ________________________________ > If you reply to this email, your message will be added to the discussion > below: > http://apache-mina.10907.n7.nabble.com/Multithreading-Client-Server-Application-tp36962p36963.html > To unsubscribe from Multithreading Client/Server Application, click here. > NAML -- ********************************************************************** Maurizio Colizza Research Engineer Università degli Studi dell'Aquila-Centro di eccellenza DEWS Cel. 3339973021 Skype : maurizio.colizza ********************************************************************** -- View this message in context: http://apache-mina.10907.n7.nabble.com/Multithreading-Client-Server-Application-tp36962p37196.html Sent from the Apache MINA Developer Forum mailing list archive at Nabble.com.
