Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 4C452200C2B for ; Thu, 2 Mar 2017 07:43:49 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 4AE72160B6F; Thu, 2 Mar 2017 06:43:49 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 927BB160B61 for ; Thu, 2 Mar 2017 07:43:48 +0100 (CET) Received: (qmail 43166 invoked by uid 500); 2 Mar 2017 06:43:47 -0000 Mailing-List: contact issues-help@activemq.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@activemq.apache.org Delivered-To: mailing list issues@activemq.apache.org Received: (qmail 43156 invoked by uid 99); 2 Mar 2017 06:43:47 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd4-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 02 Mar 2017 06:43:47 +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 047E0C028B for ; Thu, 2 Mar 2017 06:43:47 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd4-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -2.347 X-Spam-Level: X-Spam-Status: No, score=-2.347 tagged_above=-999 required=6.31 tests=[RP_MATCHES_RCVD=-2.999, SPF_NEUTRAL=0.652] autolearn=disabled Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd4-us-west.apache.org [10.40.0.11]) (amavisd-new, port 10024) with ESMTP id OL_kjzL-fTmu for ; Thu, 2 Mar 2017 06:43:46 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTP id 069B25F29C for ; Thu, 2 Mar 2017 06:43:46 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id 7CE46E012C for ; Thu, 2 Mar 2017 06:43:45 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id 33D1124158 for ; Thu, 2 Mar 2017 06:43:45 +0000 (UTC) Date: Thu, 2 Mar 2017 06:43:45 +0000 (UTC) From: "Miroslav Novak (JIRA)" To: issues@activemq.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Created] (ARTEMIS-1011) Slow consumer detection - producer msg/s rate for queue should take into account messages which are already in queue MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Thu, 02 Mar 2017 06:43:49 -0000 Miroslav Novak created ARTEMIS-1011: --------------------------------------- Summary: Slow consumer detection - producer msg/s rate for queue should take into account messages which are already in queue Key: ARTEMIS-1011 URL: https://issues.apache.org/jira/browse/ARTEMIS-1011 Project: ActiveMQ Artemis Issue Type: Bug Components: Broker Affects Versions: 1.5.3, 2.0.0 Reporter: Miroslav Novak There is still a problem how producer msg/s rate is calculated in {{QueueImpl.getRate()}} for slow consumer detection. It calculates only messages added during the last slow consumer check period. As this is used to figure out, in which msg/s rate the queue could serve the consumer then it should also take into account messages which are already in queue at the start of queueRateCheckTime period. Current implementation is problem for cases when messages are sent to queue in bursts, for example producer sends 1000s messages in a few seconds and then stops and will do that again in 1 hour. QueueImpl.getRate() method returns 0 msg/s for slow consumer check period set to for example 5 min and slow consumer detection will be skipped. I tried to fix it by following change to QueueImpl.getRate() method and seems to be ok, wdyt? {code} private final AtomicLong messageCountSnapshot = new AtomicLong(0); public float getRate() { long locaMessageAdded = getMessagesAdded(); float timeSlice = ((System.currentTimeMillis() - queueRateCheckTime.getAndSet(System.currentTimeMillis())) / 1000.0f); if (timeSlice == 0) { messagesAddedSnapshot.getAndSet(locaMessageAdded); return 0.0f; } return BigDecimal.valueOf(((locaMessageAdded - messagesAddedSnapshot.getAndSet(locaMessageAdded)) + messageCountSnapshot.getAndSet(getMessageCount())) / timeSlice).setScale(2, BigDecimal.ROUND_UP).floatValue(); } {code} -- This message was sent by Atlassian JIRA (v6.3.15#6346)