Return-Path: X-Original-To: apmail-couchdb-dev-archive@www.apache.org Delivered-To: apmail-couchdb-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 420AF8712 for ; Wed, 24 Aug 2011 22:12:52 +0000 (UTC) Received: (qmail 25921 invoked by uid 500); 24 Aug 2011 22:12:51 -0000 Delivered-To: apmail-couchdb-dev-archive@couchdb.apache.org Received: (qmail 25878 invoked by uid 500); 24 Aug 2011 22:12:51 -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 25870 invoked by uid 99); 24 Aug 2011 22:12:51 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 24 Aug 2011 22:12:51 +0000 X-ASF-Spam-Status: No, hits=-2000.5 required=5.0 tests=ALL_TRUSTED,RP_MATCHES_RCVD X-Spam-Check-By: apache.org Received: from [140.211.11.116] (HELO hel.zones.apache.org) (140.211.11.116) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 24 Aug 2011 22:12:49 +0000 Received: from hel.zones.apache.org (hel.zones.apache.org [140.211.11.116]) by hel.zones.apache.org (Postfix) with ESMTP id 699F6CE4BB for ; Wed, 24 Aug 2011 22:12:29 +0000 (UTC) Date: Wed, 24 Aug 2011 22:12:29 +0000 (UTC) From: "Paul Joseph Davis (JIRA)" To: dev@couchdb.apache.org Message-ID: <1503014349.11181.1314223949429.JavaMail.tomcat@hel.zones.apache.org> In-Reply-To: <525090287.3750.1314058529656.JavaMail.tomcat@hel.zones.apache.org> Subject: [jira] [Commented] (COUCHDB-1257) Reduction detection in share/server/views.js runReduce to primitive for some use cases and overall reduce architecture 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-1257?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13090551#comment-13090551 ] Paul Joseph Davis commented on COUCHDB-1257: -------------------------------------------- Totally just realized this is the same issue as the mailing list. Either way, yeah... > Reduction detection in share/server/views.js runReduce to primitive for some use cases and overall reduce architecture > ---------------------------------------------------------------------------------------------------------------------- > > Key: COUCHDB-1257 > URL: https://issues.apache.org/jira/browse/COUCHDB-1257 > Project: CouchDB > Issue Type: Bug > Components: JavaScript View Server > Affects Versions: 1.1 > Environment: Architecture independent > Reporter: Chris Stockton > Priority: Minor > Labels: javascript, patch > > There is two parts to this report, one is my question I have in regards to the protocol in which couchdb actually talks to the view server (server/main.js), the second part as discussed here [1] in short is the growth detection [2] done in share/server/views.js. > First issue: > While troubleshooting and tracking down this issue, I saw that when running a reduce function for every doc called, a separate read line is delegated a reset call. I do not know the internals of couchdb but it seems like it could be a performance improvement if on a rereduce call, as it appears in the server Loop function every time reduce or rereduce is called the state is first reset with "reset", to make a minor re-factor and reset the state within the Views dispatcher itself. This saves some likely blocking io back and forth. > Reduction detection: > The portion of this issue that actually has affected us is the detection done, I think that it should be changed to require a sampling of data, the easiest fix is to simply change (the very arbitrary) [2] into a large length, such as * 10 or something, but the upper bounds will always be reached for some data set. A new algorithm could take in consideration the total reduce calls thus far, as well as the initial size of the very first reduce call, to see if a large aggregation of some sort is being created. > Suggested change: > Change the signature of rereduce call to main.js to include the total count of rereduce calls thus far, or give some kind of handle where this logic could be reliably kept track of inside of main.js, as it stands now your only hope would be to use the reduce function itself as a lookup, which is not safe under all edge cases. With this information you can keep the initial rereduce calls result size, and the total number of calls, to make sure that aside from initial aggregation or structure initialization the structure is remaining constant. > There would be several other routes to go to fix this, but I think it is valid to be considered. I could volunteer my time to write a patch if a consensus could be reached on behavior, if not denied all together. > -Chris > [1] http://www.mail-archive.com/user@couchdb.apache.org/msg15250.html > [2] if (State.query_config && State.query_config.reduce_limit && > [2] reduce_length > 200 && ((reduce_length * 2) > State.line_length)) { -- This message is automatically generated by JIRA. For more information on JIRA, see: http://www.atlassian.com/software/jira