You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Omar Atia <om...@its.ws> on 2011/12/23 18:10:12 UTC

TCP Mina with Apache Camel...

Dears,

I'm using Mina endpoint in camel and I mainly have maximum 500 concurrent request coming to my endpoint , the performance is sometimes slow .

How can I manage to handle this much requests and I'm using the following configuration , it opens and disconnect session for each request.

<bean id="BBMinaEndpoint"
      factory-bean="myBBMinaFactory"
      factory-method="createEndpoint">
    <constructor-arg index="0" ref="BBConfig"/>
</bean>

<bean id="BBConfig" class="org.apache.camel.component.mina.MinaConfiguration">
    <property name="protocol" value="tcp" />
    <property name="host" value="0.0.0.0" />
    <property name="port" value="5592" />
    <property name="sync" value="true" />
    <property name="minaLogger" value="true" />
    <property name="textline" value="true"/>
    <property name="disconnect" value="true"/>
    <property name="textlineDelimiter" value="UNIX"/>
     <property name="encoderMaxLineLength" value="8912"/>
    <property name="decoderMaxLineLength" value="8912"/>

</bean>

May you advise how many should I have to handle such high number of request requests ?

Thanks,
Omar Atia

RE: TCP Mina with Apache Camel...

Posted by Omar Atia <om...@its.ws>.
Dear Willem,



The issue is that we have Call center 500 user that send a requests to My Tcp endpoint in turn after this TCP we have JAXB and Send to CXF WS .



Server has only 1 GB of memory -Xmx1024.



Now , when we put heavy load from customer on the tcp mina endpoint sometimes it takes 35 sec for tcp rout to respond note that it is synch. And the cxf endpoint WS needs only 5 -10 sec to respond .



While monitoring I found maximum inflight exchange is 10 always and seems camel pool size by default is 10 , so my solution to increase the inflight exchange number by increasing the default pool size .



So camel is processing 10 request concurrently , how can I find where camel is queuing the incoming requests? In JMX if there is ?



For sure I can't increase memory because of system limitations .



What do u suggest ?



Also what do you think of the below code from :



http://camel.apache.org/maven/current/camel-mina/apidocs/src-html/org/apache/camel/component/mina/MinaComponent.html



IoAcceptor acceptor = new SocketAcceptor(processorCount,

                    getCamelContext().getExecutorServiceStrategy().newDefaultThreadPool(this, "MinaSocketAcceptor"));

            IoConnector connector = new SocketConnector(processorCount,

                    getCamelContext().getExecutorServiceStrategy().newDefaultThreadPool(this, "MinaSocketConnector"));

            SocketAddress address = new InetSocketAddress(configuration.getHost(), configuration.getPort());



Mina is considering the default thread pool in creating threads .





Thanks,

Omar Atia



-----Original Message-----
From: Willem Jiang [mailto:willem.jiang@gmail.com]
Sent: Monday, December 26, 2011 9:24 AM
To: users@camel.apache.org
Subject: Re: TCP Mina with Apache Camel...



I think it depends on how is you camel route work. I just checked the

code of camel-mina acceptor, it just has 16 thread pool by default to

handle the request.

With the help of NIO, 16 threads can server the 500 concurrent request

if the request is handled with small amount of time.



I don't know if you did some performance test on it, please share

what's you found. We can try to do some enhancement if there are

something bad.



On Sat Dec 24 01:10:12 2011, Omar Atia wrote:

> Dears,

>

> I'm using Mina endpoint in camel and I mainly have maximum 500 concurrent request coming to my endpoint , the performance is sometimes slow .

>

> How can I manage to handle this much requests and I'm using the following configuration , it opens and disconnect session for each request.

>

> <bean id="BBMinaEndpoint"

>        factory-bean="myBBMinaFactory"

>        factory-method="createEndpoint">

>      <constructor-arg index="0" ref="BBConfig"/>

> </bean>

>

> <bean id="BBConfig" class="org.apache.camel.component.mina.MinaConfiguration">

>      <property name="protocol" value="tcp" />

>      <property name="host" value="0.0.0.0" />

>      <property name="port" value="5592" />

>      <property name="sync" value="true" />

>      <property name="minaLogger" value="true" />

>      <property name="textline" value="true"/>

>      <property name="disconnect" value="true"/>

>      <property name="textlineDelimiter" value="UNIX"/>

>       <property name="encoderMaxLineLength" value="8912"/>

>      <property name="decoderMaxLineLength" value="8912"/>

>

> </bean>

>

> May you advise how many should I have to handle such high number of request requests ?

>

> Thanks,

> Omar Atia

>







--

Willem

----------------------------------

FuseSource

Web: http://www.fusesource.com

Blog:    http://willemjiang.blogspot.com (English)

         http://jnn.javaeye.com (Chinese)

Twitter: willemjiang

Weibo: willemjiang



Re: TCP Mina with Apache Camel...

Posted by Willem Jiang <wi...@gmail.com>.
I think it depends on how is you camel route work. I just checked the 
code of camel-mina acceptor, it just has 16 thread pool by default to 
handle the request.
With the help of NIO, 16 threads can server the 500 concurrent request 
if the request is handled with small amount of time.

I don't know if you did some performance test on it, please share 
what's you found. We can try to do some enhancement if there are 
something bad.

On Sat Dec 24 01:10:12 2011, Omar Atia wrote:
> Dears,
>
> I'm using Mina endpoint in camel and I mainly have maximum 500 concurrent request coming to my endpoint , the performance is sometimes slow .
>
> How can I manage to handle this much requests and I'm using the following configuration , it opens and disconnect session for each request.
>
> <bean id="BBMinaEndpoint"
>        factory-bean="myBBMinaFactory"
>        factory-method="createEndpoint">
>      <constructor-arg index="0" ref="BBConfig"/>
> </bean>
>
> <bean id="BBConfig" class="org.apache.camel.component.mina.MinaConfiguration">
>      <property name="protocol" value="tcp" />
>      <property name="host" value="0.0.0.0" />
>      <property name="port" value="5592" />
>      <property name="sync" value="true" />
>      <property name="minaLogger" value="true" />
>      <property name="textline" value="true"/>
>      <property name="disconnect" value="true"/>
>      <property name="textlineDelimiter" value="UNIX"/>
>       <property name="encoderMaxLineLength" value="8912"/>
>      <property name="decoderMaxLineLength" value="8912"/>
>
> </bean>
>
> May you advise how many should I have to handle such high number of request requests ?
>
> Thanks,
> Omar Atia
>



-- 
Willem
----------------------------------
FuseSource
Web: http://www.fusesource.com
Blog:    http://willemjiang.blogspot.com (English)
         http://jnn.javaeye.com (Chinese)
Twitter: willemjiang 
Weibo: willemjiang 


RE: TCP Mina with Apache Camel...

Posted by Omar Atia <om...@its.ws>.
Inside netty :

corePoolSize	10	 The number of allocated threads at component startup. Defaults to 10
maxPoolSize	100	 The maximum number of threads that may be allocated to this endpoint. Defaults to 100

well, Mina take the corePoolsize from camel poolsize from camelcontext that's passed to MinaComponent.

So increasing the camel corepoolsize will increase no of threads used by Mina.

Thanks,
Omar Atia


-----Original Message-----
From: Willem Jiang [mailto:willem.jiang@gmail.com] 
Sent: Monday, December 26, 2011 10:12 AM
To: users@camel.apache.org
Subject: Re: TCP Mina with Apache Camel...

I just checked the configuration of camel-netty[1], it is very easy to 
change the change the thread pool size.

[1]http://camel.apache.org/netty.html
On 12/24/11 1:10 AM, Omar Atia wrote:
> Dears,
>
> I'm using Mina endpoint in camel and I mainly have maximum 500 concurrent request coming to my endpoint , the performance is sometimes slow .
>
> How can I manage to handle this much requests and I'm using the following configuration , it opens and disconnect session for each request.
>
> <bean id="BBMinaEndpoint"
>        factory-bean="myBBMinaFactory"
>        factory-method="createEndpoint">
>      <constructor-arg index="0" ref="BBConfig"/>
> </bean>
>
> <bean id="BBConfig" class="org.apache.camel.component.mina.MinaConfiguration">
>      <property name="protocol" value="tcp" />
>      <property name="host" value="0.0.0.0" />
>      <property name="port" value="5592" />
>      <property name="sync" value="true" />
>      <property name="minaLogger" value="true" />
>      <property name="textline" value="true"/>
>      <property name="disconnect" value="true"/>
>      <property name="textlineDelimiter" value="UNIX"/>
>       <property name="encoderMaxLineLength" value="8912"/>
>      <property name="decoderMaxLineLength" value="8912"/>
>
> </bean>
>
> May you advise how many should I have to handle such high number of request requests ?
>
> Thanks,
> Omar Atia
>


-- 
Willem
----------------------------------
FuseSource
Web: http://www.fusesource.com
Blog:    http://willemjiang.blogspot.com (English)
          http://jnn.javaeye.com (Chinese)
Twitter: willemjiang
Weibo: willemjiang

Re: TCP Mina with Apache Camel...

Posted by Willem Jiang <wi...@gmail.com>.
I just checked the configuration of camel-netty[1], it is very easy to 
change the change the thread pool size.

[1]http://camel.apache.org/netty.html
On 12/24/11 1:10 AM, Omar Atia wrote:
> Dears,
>
> I'm using Mina endpoint in camel and I mainly have maximum 500 concurrent request coming to my endpoint , the performance is sometimes slow .
>
> How can I manage to handle this much requests and I'm using the following configuration , it opens and disconnect session for each request.
>
> <bean id="BBMinaEndpoint"
>        factory-bean="myBBMinaFactory"
>        factory-method="createEndpoint">
>      <constructor-arg index="0" ref="BBConfig"/>
> </bean>
>
> <bean id="BBConfig" class="org.apache.camel.component.mina.MinaConfiguration">
>      <property name="protocol" value="tcp" />
>      <property name="host" value="0.0.0.0" />
>      <property name="port" value="5592" />
>      <property name="sync" value="true" />
>      <property name="minaLogger" value="true" />
>      <property name="textline" value="true"/>
>      <property name="disconnect" value="true"/>
>      <property name="textlineDelimiter" value="UNIX"/>
>       <property name="encoderMaxLineLength" value="8912"/>
>      <property name="decoderMaxLineLength" value="8912"/>
>
> </bean>
>
> May you advise how many should I have to handle such high number of request requests ?
>
> Thanks,
> Omar Atia
>


-- 
Willem
----------------------------------
FuseSource
Web: http://www.fusesource.com
Blog:    http://willemjiang.blogspot.com (English)
          http://jnn.javaeye.com (Chinese)
Twitter: willemjiang
Weibo: willemjiang