Hi,
I just start using mina. I want  using mine to build a server
which can   support big connections(e.g. 10K).
After read the tutorials and the mina demo code, I change the echoServer to
test the performance , I want use the Thread Pool to handle the coming
connections.
so I add a ExecutorFiter to the FilterChain,
the code like this:

SocketAcceptor acceptor = new NioSocketAcceptor();
DefaultIoFilterChainBuilder chain = acceptor.getFilterChain();
ThreadPoolExecutor threadPool = new ThreadPoolExecutor(1000,2000,600L,
TimeUnit.SECONDS,new ArrayBlockingQueue<Runnable>(1000),new
ThreadPoolExecutor.CallerRunsPolicy());

int threadNum = threadPool.prestartAllCoreThreads();

chain.addLast("threadPool", new ExecutorFilter(threadPool));
...

then I use JMeter to test the server.
the JMeter parameters:
Thread Num: 600
Ramp-up Period(in Seconds):1
loop num: 1

the samper: tcp samper
timeout:5000
no dely: ture

and the test result almost is OK, but also has a lot of can not get
response  ,like:

<sample t="1718" lt="0" ts="1206608005656" s="true" lb="TCP取样器" rc="200"
rm="OK" tn="线程组 1-213" dt="text" by="2"/>
<sample t="1733" lt="0" ts="1206608005641" s="true" lb="TCP取样器" rc="200"
rm="OK" tn="线程组 1-209" dt="text" by="2"/>
<sample t="937" lt="0" ts="1206608006468" s="false" lb="TCP取样器" rc="500"
rm="java.net.ConnectException: Connection refused: connect" tn="线程组 1-440"
dt="" by="0"/>
<sample t="937" lt="0" ts="1206608006468" s="false" lb="TCP取样器" rc="500"
rm="java.net.ConnectException: Connection refused: connect" tn="线程组 1-439"
dt="" by="0"/>
<sample t="968" lt="0" ts="1206608006437" s="false" lb="TCP取样器" rc="500"
rm="java.net.ConnectException: Connection refused: connect" tn="线程组 1-431"
dt="" by="0"/>
<sample t="952" lt="0" ts="1206608006453" s="false" lb="TCP取样器" rc="500"
rm="java.net.ConnectException: Connection refused: connect" tn="线程组 1-433"
dt="" by="0"/>
<sample t="1015" lt="0" ts="1206608006390" s="false" lb="TCP取样器" rc="500"
rm="java.net.ConnectException: Connection refused: connect" tn="线程组 1-417"
dt="" by="0"/>
<sample t="1015" lt="0" ts="1206608006390" s="false" lb="TCP取样器" rc="500"
rm="java.net.ConnectException: Connection refused: connect" tn="线程组 1-415"
dt="" by="0"/>
<sample t="1046" lt="0" ts="1206608006359" s="false" lb="TCP取样器" rc="500"
rm="java.net.ConnectException: Connection refused: connect" tn="线程组 1-409"
dt="" by="0"/>
<sample t="937" lt="0" ts="1206608006468" s="false" lb="TCP取样器" rc="500"
rm="java.net.ConnectException: Connection refused: connect" tn="线程组 1-441"
dt="" by="0"/>
<sample t="1000" lt="0" ts="1206608006421" s="false" lb="TCP取样器" rc="500"
rm="java.net.ConnectException: Connection refused: connect" tn="线程组 1-424"
dt="" by="0"/>
<sample t="984" lt="0" ts="1206608006437" s="false" lb="TCP取样器" rc="500"
rm="java.net.ConnectException: Connection refused: connect" tn="线程组 1-430"
dt="" by="0"/>
<sample t="984" lt="0" ts="1206608006437" s="false" lb="TCP取样器" rc="500"
rm="java.net.ConnectException: Connection refused: connect" tn="线程组 1-428"
dt="" by="0"/>
<sample t="953" lt="0" ts="1206608006468" s="false" lb="TCP取样器" rc="500"
rm="java.net.ConnectException: Connection refused: connect" tn="线程组 1-438"
dt="" by="0"/>
<sample t="1000" lt="0" ts="1206608006421" s="false" lb="TCP取样器" rc="500"
rm="java.net.ConnectException: Connection refused: connect" tn="线程组 1-426"
dt="" by="0"/>
<sample t="1031" lt="0" ts="1206608006390" s="false" lb="TCP取样器" rc="500"
rm="java.net.ConnectException: Connection refused: connect" tn="线程组 1-419"
dt="" by="0"/>
<sample t="968" lt="0" ts="1206608006437" s="false" lb="TCP取样器" rc="500"
rm="java.net.ConnectException: Connection refused: connect" tn="线程组 1-429"
dt="" by="0"/>
<sample t="1000" lt="0" ts="1206608006421" s="false" lb="TCP取样器" rc="500"
rm="java.net.ConnectException: Connection refused: connect" tn="线程组 1-423"
dt="" by="0"/>
<sample t="1062" lt="0" ts="1206608006359" s="false" lb="TCP取样器" rc="500"
rm="java.net.ConnectException: Connection refused: connect" tn="线程组 1-407"
dt="" by="0"/>
<sample t="1062" lt="0" ts="1206608006359" s="false" lb="TCP取样器" rc="500"
rm="java.net.ConnectException: Connection refused: connect" tn="线程组 1-408"
dt="" by="0"/>
<sample t="1000" lt="0" ts="1206608006421" s="false" lb="TCP取样器" rc="500"
rm="java.net.ConnectException: Connection refused: connect" tn="线程组 1-427"
dt="" by="0"/>
<sample t="1015" lt="0" ts="1206608006421" s="false" lb="TCP取样器" rc="500"
rm="java.net.ConnectException: Connection refused: connect" tn="线程组 1-425"
dt="" by="0"/>
<sample t="1062" lt="0" ts="1206608006374" s="false" lb="TCP取样器" rc="500"
rm="java.net.ConnectException: Connection refused: connect" tn="线程组 1-411"
dt="" by="0"/>
<sample t="983" lt="0" ts="1206608006453" s="false" lb="TCP取样器" rc="500"
rm="java.net.ConnectException: Connection refused: connect" tn="线程组 1-432"
dt="" by="0"/>
<sample t="1046" lt="0" ts="1206608006390" s="false" lb="TCP取样器" rc="500"
rm="java.net.ConnectException: Connection refused: connect" tn="线程组 1-416"
dt="" by="0"/>
<sample t="1859" lt="0" ts="1206608005609" s="true" lb="TCP取样器" rc="200"
rm="OK" tn="线程组 1-200" dt="text" by="2"/>
<sample t="1889" lt="0" ts="1206608005594" s="true" lb="TCP取样器" rc="200"
rm="OK" tn="线程组 1-197" dt="text" by="2"/>

so I want to know how reduce the "java.net.ConnectException: Connection
refused", and improve the performance :

also I am not sure set the JMeter parameter Ramp-up Period(in Seconds): to 1
is suitable.

any suggestion, thanks!

Reply via email to