Return-Path: Delivered-To: apmail-couchdb-dev-archive@www.apache.org Received: (qmail 15371 invoked from network); 12 Jun 2010 13:37:35 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 12 Jun 2010 13:37:35 -0000 Received: (qmail 59535 invoked by uid 500); 12 Jun 2010 13:37:35 -0000 Delivered-To: apmail-couchdb-dev-archive@couchdb.apache.org Received: (qmail 59378 invoked by uid 500); 12 Jun 2010 13:37:34 -0000 Mailing-List: contact dev-help@couchdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@couchdb.apache.org Delivered-To: mailing list dev@couchdb.apache.org Received: (qmail 59370 invoked by uid 99); 12 Jun 2010 13:37:34 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 12 Jun 2010 13:37:34 +0000 X-ASF-Spam-Status: No, hits=-1516.3 required=10.0 tests=ALL_TRUSTED,AWL X-Spam-Check-By: apache.org Received: from [140.211.11.22] (HELO thor.apache.org) (140.211.11.22) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 12 Jun 2010 13:37:33 +0000 Received: from thor (localhost [127.0.0.1]) by thor.apache.org (8.13.8+Sun/8.13.8) with ESMTP id o5CDbDQZ006007 for ; Sat, 12 Jun 2010 13:37:13 GMT Message-ID: <17578944.62881276349833371.JavaMail.jira@thor> Date: Sat, 12 Jun 2010 09:37:13 -0400 (EDT) From: "Adam Kocoloski (JIRA)" To: dev@couchdb.apache.org Subject: [jira] Commented: (COUCHDB-797) PATCH: couch_stats_aggregator should use queue instead of list In-Reply-To: <4100588.58761276317433545.JavaMail.jira@thor> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/COUCHDB-797?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12878264#action_12878264 ] Adam Kocoloski commented on COUCHDB-797: ---------------------------------------- Hi Sean, thanks for bringing this up. I spent a few minutes looking at the patch, but I'm having a hard convincing myself that a queue is warranted here. Adding a value to the head of a list is cheaper than inserting into a queue, so I think the important part of the patch is the reimplementation of rem_values/2. I can see where the original implementation would be sub-optimal if the Keep list is typically large. I'm not familiar enough with the server state to say whether that's the case. But if it is, I would maybe try reversing the list and flipping the comparator in the predicate function in order to reach the split condition sooner. One other thing the original code did poorly was the case statement case length(Agg#aggregate.samples) > 0 true -> ... that should be e.g. case Agg#aggregate.samples of [ _ | _ ] Sean, do you have some code to demonstrate the improvement? I'd be keen to compare the queue approach with a few list-based alternatives. > PATCH: couch_stats_aggregator should use queue instead of list > -------------------------------------------------------------- > > Key: COUCHDB-797 > URL: https://issues.apache.org/jira/browse/COUCHDB-797 > Project: CouchDB > Issue Type: Improvement > Components: Database Core > Reporter: Sean Bartell > Priority: Minor > Attachments: 0001-stats-use-queue-instead-of-list-for-speed.patch > > > couch_stats_aggregator uses a list to store samples, but many times per second adds a value to the front or removes one from the end. This patch makes it use a queue instead. Statistics take up little CPU time, but there's a noticeable improvement when CouchDB is idle. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.