2016-03-08 67 views
2

我在ServiceMix中遇到了駝峯問題。servicemix上的CAMEL線程鎖

我通過camel-jetty,servicemix中的駱駝配方列表製作了webservice。 該軟件包性能良好,但資源鎖定和線程已完全發生。這個系統進程每秒調用40次。

問題是有時池線程沒有正確釋放。 以下的應用程序,我可以看到使用jstack 工具,某些線程都停留在等待狀態的開始幾個小時後:

配置如下: - ServiceMix的5.3.0 - 駱駝2.13.2 - 使用成分(駱駝碼頭,駱駝recipentlist基於Spring DSL)

-source

<route customId="true" > 
<from uri="direct:giop_addr_async"> 
    <recipentList> 
      <simple>jetty://http://api.host.lm?x=${header.x}&y=${header.y}</simple> 
    </recipentList> 
    <bean ref="soapDecode" method="userDecode"/> 
    <to uri="direct:sendEndPoint"> 
</route> 
<route customId="true> 
    <from uri="direct:sendEndPoint"> 
    <to uri="jetty://http://resultMap?httpClient.soTimeout=80000"/> 
</route> 

-------------- LOG

ps -eLf | wc -l --> 32500 



"CamelJettyClient(0x3d0b240d)-26916" damen prio=10 tid=0x000000000ff69800 nid =0x10ef wating on condition [0x00002b4b3ba3f0000] 
    java.lang.Thread.State: TIMED_WAITNG(parking) 
    at sun.misc.Unsafe.park(Native Method) 
- parking to wait for <0x000000006f13f19b0> (a java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject) 
at java.util.concurrent.locks.LocsSupport.parkNanos(LockSupport,java:226) 
at org.eclipse.jetty.util.BlockingArrayQueue.poll(BlockingArrayQueue.java:342) 
at org.eclipse.jetty.util.thread.QueuedThreadPool.idleJobPoss(QueuedThreadPool.java:526) 
at org.eclipse.jetty.tuil.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:572) 
at java.lnag.thread.run(Thread.java:745) 

上面的日誌超過了30000行。

你能提出什麼可以檢查嗎?我錯過了什麼嗎?或者可能是 這是駱駝中的一個錯誤?

回答

0

使線程處於等待狀態並不正常,但30.000線程很多。

您正在使用recipientList:對於x和y的每個組合,您正在創建一個新的碼頭生產者。每個碼頭生產者都有自己的線程池,並且駱駝在緩存中保存最後生成的創建者:在這裏創建大量的線程池和線程。

您不需要一個recipientList以便動態創建一個URL。您可以使用頭Exchange.HTTP_URI

例如:

<route customId="true" > 
<from uri="direct:giop_addr_async"> 
    <setHeader headerName="CamelHttpUri"> 
      <simple>jetty://http://api.host.lm?x=${header.x}&y=${header.y}</simple> 
    </setHeader> 
    <to uri="jetty://http://api.host.lm"/> 
    <bean ref="soapDecode" method="userDecode"/> 
    <to uri="direct:sendEndPoint"> 
</route> 
<route customId="true> 
    <from uri="direct:sendEndPoint"> 
    <to uri="jetty://http://resultMap?httpClient.soTimeout=80000"/> 
</route>