You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@couchdb.apache.org by "Sean Bartell (JIRA)" <ji...@apache.org> on 2010/06/12 06:37:13 UTC

[jira] Created: (COUCHDB-797) PATCH: couch_stats_aggregator should use queue instead of list

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.


[jira] Commented: (COUCHDB-797) PATCH: couch_stats_aggregator should use queue instead of list

Posted by "Adam Kocoloski (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/COUCHDB-797?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12878271#action_12878271 ] 

Adam Kocoloski commented on COUCHDB-797:
----------------------------------------

Hi Sean, `make check` fails for me with this patch.  Can you double-check it?

/usr/local/src/couchdb/test/etap/121-stats-aggregates...............FAILED tests 7, 9, 11, 13, 15, 17
	Failed 6/17 tests, 64.71% okay


> 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.


[jira] Commented: (COUCHDB-797) PATCH: couch_stats_aggregator should use queue instead of list

Posted by "Adam Kocoloski (JIRA)" <ji...@apache.org>.
    [ 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.


[jira] Updated: (COUCHDB-797) PATCH: couch_stats_aggregator should use queue instead of list

Posted by "Paul Joseph Davis (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/COUCHDB-797?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Paul Joseph Davis updated COUCHDB-797:
--------------------------------------

    Skill Level: New Contributors Level (Easy)

> 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.


[jira] Updated: (COUCHDB-797) PATCH: couch_stats_aggregator should use queue instead of list

Posted by "Sean Bartell (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/COUCHDB-797?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sean Bartell updated COUCHDB-797:
---------------------------------

    Attachment: 0001-stats-use-queue-instead-of-list-for-speed.patch

Patch.

> 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.