Return-Path: X-Original-To: apmail-activemq-users-archive@www.apache.org Delivered-To: apmail-activemq-users-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 0EB9818644 for ; Fri, 27 Nov 2015 01:39:22 +0000 (UTC) Received: (qmail 85568 invoked by uid 500); 27 Nov 2015 01:39:16 -0000 Delivered-To: apmail-activemq-users-archive@activemq.apache.org Received: (qmail 85515 invoked by uid 500); 27 Nov 2015 01:39:16 -0000 Mailing-List: contact users-help@activemq.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@activemq.apache.org Delivered-To: mailing list users@activemq.apache.org Received: (qmail 85503 invoked by uid 99); 27 Nov 2015 01:39:16 -0000 Received: from Unknown (HELO spamd4-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 27 Nov 2015 01:39:16 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd4-us-west.apache.org (ASF Mail Server at spamd4-us-west.apache.org) with ESMTP id E9FEDC103F for ; Fri, 27 Nov 2015 01:39:15 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd4-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 2.879 X-Spam-Level: ** X-Spam-Status: No, score=2.879 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HTML_MESSAGE=3, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_PASS=-0.001] autolearn=disabled Authentication-Results: spamd4-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com Received: from mx1-us-west.apache.org ([10.40.0.8]) by localhost (spamd4-us-west.apache.org [10.40.0.11]) (amavisd-new, port 10024) with ESMTP id e0HPsZcOKY_q for ; Fri, 27 Nov 2015 01:39:14 +0000 (UTC) Received: from mail-ob0-f170.google.com (mail-ob0-f170.google.com [209.85.214.170]) by mx1-us-west.apache.org (ASF Mail Server at mx1-us-west.apache.org) with ESMTPS id 88D8E232B4 for ; Fri, 27 Nov 2015 01:39:14 +0000 (UTC) Received: by obbww6 with SMTP id ww6so72858882obb.0 for ; Thu, 26 Nov 2015 17:39:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=kdrI70RyXU3JnVmDpaxw3omJPgYy5TIEHaYFExwdAhc=; b=lrhaSiDKUM5JQs/sMpgV0ixXFBL+nEZ7VkdVjC1+THfxBvZpa4SX/s03ZYBM69BKgn rU+0R9rGatePvcO238MlGH/OPEopTFEBXfN3giayG4fkVYL2pzY7sanOU6b96D1VMnQj ub2Kx9E4n3TWY97gFIe8/XPy5uC9RkYG2vFDouKif52uyq4TCRAgP+BJX1hqIjfpPqu1 2QPRQmmlcqISq+tAy4bKEhQOj0E5Oiyh4ydpu/knCj7/6BfZ8Dy9oS+anYrjLFGn/Gi2 8LB8nTm2bFSpNVVh7+Z+jbPpZHvrC/rxajFiZb4BFoVryRU6M9Yuu1gu9rfZazU6WFmL GQSA== MIME-Version: 1.0 X-Received: by 10.60.64.103 with SMTP id n7mr32639773oes.71.1448588353946; Thu, 26 Nov 2015 17:39:13 -0800 (PST) Received: by 10.202.175.14 with HTTP; Thu, 26 Nov 2015 17:39:13 -0800 (PST) In-Reply-To: References: Date: Fri, 27 Nov 2015 12:39:13 +1100 Message-ID: Subject: Re: Performance issue in OrderedPendingList From: David Sitsky To: users@activemq.apache.org Content-Type: multipart/alternative; boundary=001a11c3acce434bf905257bc23c --001a11c3acce434bf905257bc23c Content-Type: text/plain; charset=UTF-8 FWIW I changed the contains method as follows: @Override public boolean contains(MessageReference message) { if (message != null) { return map.containsKey(message.getMessageId()); } return false; } I got a speedup for my test taking 29 minutes from 41 minutes. Can we get this change in to the upcoming 5.13 release? On Thu, Nov 26, 2015 at 11:44 AM, David Sitsky wrote: > Hi, > > I have updated my application from ActiveMQ 5.3 to 5.11.1 and have noticed > a performance degregation issue. Running a number of jstacks I can see the > broker is often stuck here: > > "Queue:master-items" Id=122 RUNNABLE > at > org.apache.activemq.broker.region.cursors.OrderedPendingList.contains(OrderedPendingList.java:144) > at > org.apache.activemq.broker.region.Queue.doPageInForDispatch(Queue.java:1930) > at org.apache.activemq.broker.region.Queue.pageInMessages(Queue.java:2119) > at org.apache.activemq.broker.region.Queue.iterate(Queue.java:1596) > - locked java.lang.Object@253c3089 > at > org.apache.activemq.thread.DedicatedTaskRunner.runTask(DedicatedTaskRunner.java:112) > at > org.apache.activemq.thread.DedicatedTaskRunner$1.run(DedicatedTaskRunner.java:42) > > Number of locked synchronizers = 1 > - java.util.concurrent.locks.ReentrantReadWriteLock$NonfairSync@2eb46567 > > For this specific queue, there are a large number of items in it.. around > 100,000. However I noticed the code for contains has: > > public boolean contains(MessageReference message) { > if (message != null) { > for (PendingNode value : map.values()) { > if (value.getMessage().equals(message)) { > return true; > } > } > } > return false; > } > > This will obviously be very slow. Given the Map is keyed by message ID, > can't we do a .contains(message.getMessageId()) instead? I noticed the > remove() method does this. I am not familiar with the internals of > ActiveMQ, so I don't know the ramifications of this. > > Cheers, > David > --001a11c3acce434bf905257bc23c--