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 7D415200D26 for ; Fri, 20 Oct 2017 16:10:06 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 7C09E160BED; Fri, 20 Oct 2017 14:10:06 +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 C10C31609E1 for ; Fri, 20 Oct 2017 16:10:05 +0200 (CEST) Received: (qmail 83399 invoked by uid 500); 20 Oct 2017 14:10:04 -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 83390 invoked by uid 99); 20 Oct 2017 14:10:04 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 20 Oct 2017 14:10:04 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id 0C47C180725 for ; Fri, 20 Oct 2017 14:10:04 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -99.202 X-Spam-Level: X-Spam-Status: No, score=-99.202 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, RP_MATCHES_RCVD=-0.001, SPF_PASS=-0.001, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id Jc9RT78rlFo7 for ; Fri, 20 Oct 2017 14:10:03 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTP id 549A55FBEA for ; Fri, 20 Oct 2017 14:10:02 +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 9E99AE0D65 for ; Fri, 20 Oct 2017 14:10:01 +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 39BCA21EE7 for ; Fri, 20 Oct 2017 14:10:01 +0000 (UTC) Date: Fri, 20 Oct 2017 14:10:01 +0000 (UTC) From: "ASF GitHub Bot (JIRA)" To: issues@activemq.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (ARTEMIS-1474) TimedBuffer need sleep error detection measured against the expected timeout MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Fri, 20 Oct 2017 14:10:06 -0000 [ https://issues.apache.org/jira/browse/ARTEMIS-1474?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16212682#comment-16212682 ] ASF GitHub Bot commented on ARTEMIS-1474: ----------------------------------------- Github user franz1981 commented on a diff in the pull request: https://github.com/apache/activemq-artemis/pull/1602#discussion_r145972883 --- Diff: artemis-journal/src/main/java/org/apache/activemq/artemis/core/io/buffer/TimedBuffer.java --- @@ -34,6 +34,25 @@ import org.apache.activemq.artemis.journal.ActiveMQJournalLogger; public final class TimedBuffer { + + /** + * Property name to set the percentage of error allowed while expiring the flush {@code timeout} to happen: + * it can assume any positive value from {@code 0} to {@link Integer#MAX_VALUE}. + *

+ * By default it is {@link #DEFAULT_TIMEOUT_ERROR_PERCENTAGE} more than the configured {@code timeout}. + */ + public static final String JOURNAL_TIMEOUT_ERROR_PROPERTY_NAME = "journal.timeout.error"; + public static final int DEFAULT_TIMEOUT_ERROR_PERCENTAGE = 50; + private static final double MAX_TIMEOUT_ERROR; + + static { + final int errorPercentage = Integer.getInteger(JOURNAL_TIMEOUT_ERROR_PROPERTY_NAME, DEFAULT_TIMEOUT_ERROR_PERCENTAGE); + if (errorPercentage < 0) { + throw new RuntimeException("The sleep error percentage must be >= 0"); + } + MAX_TIMEOUT_ERROR = 1 + (errorPercentage / 100); --- End diff -- ahah is not a magic number: it is the same as before :) The old one was `0,5` ( ie `50%`): `max timeout error = 1,5 = 1 + 0,5 = 1 + (50/100)` > TimedBuffer need sleep error detection measured against the expected timeout > ---------------------------------------------------------------------------- > > Key: ARTEMIS-1474 > URL: https://issues.apache.org/jira/browse/ARTEMIS-1474 > Project: ActiveMQ Artemis > Issue Type: Improvement > Reporter: Francesco Nigro > Assignee: Francesco Nigro > Priority: Minor > > The current TimedBuffer implementation evaluate the sleep accuracy measuring the error against the elapsed sleep time while the original version was using the error related to the overall expected timeout: It would be better due to the sleep/parkNanos behaviour to maintain the original evaluation method, but using the improved discounted (with the last flush time) sleep time in order to not exeeding to delay flushes. -- This message was sent by Atlassian JIRA (v6.4.14#64029)