Hello guys,
I have been using MINA in my protocol implementation project and
sometimes posted some questions to here. I have set up my framework
similar to "reverser" example with protocol encoders and decoders and I
added Thread pools by using SimpleServiceRegistry. I have already
finished my project but i have some performance problems (response time
problems) under heavy loads. I have taken NoAnswerExceptions from my
application due to exceeding of response time limit. My decoder is a
thick one, and consume some important parts of response time. If i did
not use MINA, i would handle this decoding process by parallel threads.
But after a thorough read MINA documentation, i have thought that
IoThreadPool can handle high traffic by increasing the number of its
worker threads which use Decoder objects. But in my traffic test, i
cannot see that IoThreadPool has more than two threads. Although in
client side, i write objects into session concurrently by more than 100
threads, in server side there is only 2 threads. Am i wrong or did i do
something wrong ? How can i increase the number of threads in IOThread
pool ??
This is a sample from my client code.
int numOfThreads = 100;
for (int i = 0; i < numOfThreads; i++) {
thread[i] = new TrafficWorker(session);
thread[i].setName("Thread#" + i);
}
for (int a = 0; a < numOfThreads; a++) {
thread[a].start();
Thread.sleep(48);
}
class TrafficWorker extends Thread {
public TrafficWorker(ProtocolSession session){
this.session =session;
}
public void run() {
while(true){
session.write(new String("Hello"));
Thread.sleep(1);
}
}