You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Blue Diamond <gv...@gmail.com> on 2011/09/05 09:04:59 UTC
Max. no. of client connections supported by CXF (Jetty)
Hi,
We are trying to run some stress testing on our REST service but in that
process, we found that there are no issues when we ran 1000 parallel client
connections. But when we increased the clients to 2000, we found errors that
indicate server could not accept connections. If we configure our clients to
retry, all clients run to completion.
But this capacity of < 2000 looks like a big limitation for us. How can we
increase the max. no. of client connections the underlying Jetty of CXF
2.3.x can accept?
I am trying to do something like this:
ThreadingParameters tp = new ThreadingParameters();
tp.setMaxThreads(6000);
tp.setMinThreads(2000);
Map<String, ThreadingParameters> tpMap = new HashMap<String,
ThreadingParameters>();
tpMap.put(httpsPort + "", tp);
JettyHTTPServerEngineFactory jettyFactory = new
JettyHTTPServerEngineFactory();
jettyFactory.setThreadingParametersMap(tpMap);
Will this work? I don't see any other support in API to achieve this? Please
help me :)
Thanks & Regards,
Anil
Re: Max. no. of client connections supported by CXF (Jetty)
Posted by Blue Diamond <gv...@gmail.com>.
cool! :) thanks a lot Freeman.
On Tue, Sep 6, 2011 at 7:12 AM, Freeman Fang <fr...@gmail.com> wrote:
> Hi,
>
> Generally speaking, more thread need more resource from your machine, so
> you absolutely need a powerful machine if you specify a huge max_threads
> which can handle more concurrent client. Or sometime even one powerful
> machine can't meet your requirement, so you may consider to use cluster and
> load balance in that case.
>
> Freeman
>
> On 2011-9-5, at 下午11:19, Blue Diamond wrote:
>
> Thanks a lot Freeman!
>>
>> Just another question.
>> Will there be any performance impact or problems if I set this max_threads
>> to say 16000?
>>
>> Regards,
>> Anil
>>
>
> ------------------------------**---------------
> Freeman Fang
>
> FuseSource
> Email:ffang@fusesource.com
> Web: fusesource.com
> Twitter: freemanfang
> Blog: http://freemanfang.blogspot.**com <http://freemanfang.blogspot.com>
>
>
>
>
>
>
>
>
>
>
Re: Max. no. of client connections supported by CXF (Jetty)
Posted by Freeman Fang <fr...@gmail.com>.
Hi,
Generally speaking, more thread need more resource from your machine,
so you absolutely need a powerful machine if you specify a huge
max_threads which can handle more concurrent client. Or sometime even
one powerful machine can't meet your requirement, so you may consider
to use cluster and load balance in that case.
Freeman
On 2011-9-5, at 下午11:19, Blue Diamond wrote:
> Thanks a lot Freeman!
>
> Just another question.
> Will there be any performance impact or problems if I set this
> max_threads
> to say 16000?
>
> Regards,
> Anil
---------------------------------------------
Freeman Fang
FuseSource
Email:ffang@fusesource.com
Web: fusesource.com
Twitter: freemanfang
Blog: http://freemanfang.blogspot.com
Re: Max. no. of client connections supported by CXF (Jetty)
Posted by Blue Diamond <gv...@gmail.com>.
Thanks a lot Freeman!
Just another question.
Will there be any performance impact or problems if I set this max_threads
to say 16000?
Regards,
Anil
Re: Max. no. of client connections supported by CXF (Jetty)
Posted by Freeman Fang <fr...@gmail.com>.
Hi,
You can configure the underlying jetty through something like
<beans xsi:schemaLocation=" http://cxf.apache.org/configuration/security
http://cxf.apache.org/schemas/configuration/
security.xsd http://cxf.apache.org/transports/http/configuration
http://cxf.apache.org/schemas/configuration/http-
conf.xsd http://cxf.apache.org/transports/http-jetty/configuration
http://cxf.apache.org/schemas/configuration/http-
jetty.xsd http://www.springframework.org/schema/
beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
">
<http:destination name="{http://apache.org/cxf/
calculator}CalculatorPort.http-destination">
</http:destination>
<httpj:engine-factory bus="cxf">
<httpj:engine port="19000">
<httpj:threadingParameters minThreads="what_ever_you_want"
maxThreads="what_ever_you_want"/>
</httpj:engine>
</httpj:engine-factory>
</beans>
Freeman
On 2011-9-5, at 下午3:27, Blue Diamond wrote:
> My REST client see the following Exception as the no. of parallel
> clients
> increase from 1000 to 2000:
>
> (3 failures in 2000 client requests).
>
> java.net.SocketException: Connection reset
> at java.net.SocketInputStream.read(SocketInputStream.java:168)
> at java.io.BufferedInputStream.fill(BufferedInputStream.java:218)
> at java.io.BufferedInputStream.read(BufferedInputStream.java:237)
> at
> org.apache.commons.httpclient.HttpParser.readRawLine(HttpParser.java:
> 77)
> at org.apache.commons.httpclient.HttpParser.readLine(HttpParser.java:
> 105)
> at
> org
> .apache
> .commons.httpclient.HttpConnection.readLine(HttpConnection.java:1115)
> at
> org
> .apache
> .commons
> .httpclient.HttpMethodBase.readStatusLine(HttpMethodBase.java:1832)
> at
> org
> .apache
> .commons.httpclient.HttpMethodBase.readResponse(HttpMethodBase.java:
> 1590)
> at
> org
> .apache
> .commons.httpclient.HttpMethodBase.execute(HttpMethodBase.java:995)
> at
> org
> .apache
> .commons
> .httpclient
> .HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:397)
> at
> org
> .apache
> .commons
> .httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:
> 170)
> at
> org
> .apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:
> 396)
> at
> org
> .apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:
> 324)
> at Myclient.GET.run(StressTestingRESTClient.java:100)
> at
> java.util.concurrent.ThreadPoolExecutor
> $Worker.runTask(ThreadPoolExecutor.java:886)
> at
> java.util.concurrent.ThreadPoolExecutor
> $Worker.run(ThreadPoolExecutor.java:908)
> at java.lang.Thread.run(Thread.java:619)
---------------------------------------------
Freeman Fang
FuseSource
Email:ffang@fusesource.com
Web: fusesource.com
Twitter: freemanfang
Blog: http://freemanfang.blogspot.com
Re: Max. no. of client connections supported by CXF (Jetty)
Posted by Blue Diamond <gv...@gmail.com>.
My REST client see the following Exception as the no. of parallel clients
increase from 1000 to 2000:
(3 failures in 2000 client requests).
java.net.SocketException: Connection reset
at java.net.SocketInputStream.read(SocketInputStream.java:168)
at java.io.BufferedInputStream.fill(BufferedInputStream.java:218)
at java.io.BufferedInputStream.read(BufferedInputStream.java:237)
at org.apache.commons.httpclient.HttpParser.readRawLine(HttpParser.java:77)
at org.apache.commons.httpclient.HttpParser.readLine(HttpParser.java:105)
at
org.apache.commons.httpclient.HttpConnection.readLine(HttpConnection.java:1115)
at
org.apache.commons.httpclient.HttpMethodBase.readStatusLine(HttpMethodBase.java:1832)
at
org.apache.commons.httpclient.HttpMethodBase.readResponse(HttpMethodBase.java:1590)
at
org.apache.commons.httpclient.HttpMethodBase.execute(HttpMethodBase.java:995)
at
org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:397)
at
org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:170)
at
org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:396)
at
org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:324)
at Myclient.GET.run(StressTestingRESTClient.java:100)
at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:619)