Return-Path: Delivered-To: apmail-camel-dev-archive@www.apache.org Received: (qmail 61606 invoked from network); 12 Oct 2009 16:08:18 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 12 Oct 2009 16:08:18 -0000 Received: (qmail 1086 invoked by uid 500); 12 Oct 2009 16:08:17 -0000 Delivered-To: apmail-camel-dev-archive@camel.apache.org Received: (qmail 1026 invoked by uid 500); 12 Oct 2009 16:08:17 -0000 Mailing-List: contact dev-help@camel.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@camel.apache.org Delivered-To: mailing list dev@camel.apache.org Received: (qmail 1016 invoked by uid 500); 12 Oct 2009 16:08:17 -0000 Delivered-To: apmail-activemq-camel-dev@activemq.apache.org Received: (qmail 1013 invoked by uid 99); 12 Oct 2009 16:08:17 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 12 Oct 2009 16:08:17 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.140] (HELO brutus.apache.org) (140.211.11.140) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 12 Oct 2009 16:08:14 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 8E6ED234C1EF for ; Mon, 12 Oct 2009 09:07:53 -0700 (PDT) Message-ID: <1083316494.1255363673580.JavaMail.jira@brutus> Date: Mon, 12 Oct 2009 09:07:53 -0700 (PDT) From: "Fabrice Delaporte (JIRA)" To: camel-dev@activemq.apache.org Subject: [jira] Commented: (CAMEL-1930) Synchronized access to XPathExpression resulting in contention for multiple consumers In-Reply-To: <2080826390.1251105350107.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: ae95407df07c98740808b2ef9da0087c X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/activemq/browse/CAMEL-1930?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=54718#action_54718 ] Fabrice Delaporte commented on CAMEL-1930: ------------------------------------------ Hi Claus, Sorry for the delay, been quite busy these days but finally got some time to run some tests against your patch. Attached is my own version (heavily inspired by your own test case). By the way, why are you using an Executor to send your message to the SEDA queue ? Being an asynchronous endpoint I'm not sure I see the point in using a thread pool. Anyway, I'm sending 100 000 xml messages (a little bit bigger than yours) to the seda queue, and then awaits for the mock endpoints to reach their expected message count to measure actual processing time. The XPath expression is also closer from what we may have here in production (kind of a big switch on the message type, there may be more efficient ways to do that (especially get rid of the // wild card to put a true /message/messagetype) but that's not the point here, the point is that we get something heavier on the CPU side. And, actually, setting a low value for consumer count does not prevent contention from happening (10 in my test case). Results are pretty cool. On my computer it gives on average : - around 150s without your patch - around 110s with the patch That's about 36% faster, so I think it's worth including the patch, although I have to admit that the performance difference is smaller than what I had expected (I guess that the more cores you have, the bigger the difference). In addition to that I also attached two screenshots of my instance of JVisualVM to show contention without the patch (red threads) and with the patch (yeah, that green is beautiful). Cheers, Fabrice > Synchronized access to XPathExpression resulting in contention for multiple consumers > ------------------------------------------------------------------------------------- > > Key: CAMEL-1930 > URL: https://issues.apache.org/activemq/browse/CAMEL-1930 > Project: Apache Camel > Issue Type: Bug > Components: camel-core > Affects Versions: 2.0-M3 > Environment: Java 1.6, Spring 2.5.6 > Reporter: Fabrice Delaporte > Assignee: Claus Ibsen > Fix For: 2.1.0 > > Attachments: camel_1930.patch, with-contention.jpg, without-contention.jpg, XPathRouteConcurrentBigTest.java > > > Hi, > I'm using Camel to do some JMS message routing. Messages are XML so xpath is a natural choice. > However when using a choice with an xpath expression, the XPathBuilder creates one XPathExpression object. According to the specification, these objects are not thread safe so synchronizing looks natural. But then, using multiple jms consumers is totally useless since no concurrent evaluations can be made. > XPathExpression objects would rather need to be stored in a ThreadLocal to avoid synchronization and contention. > Cheers, > Fabrice -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.