Return-Path: Delivered-To: apmail-couchdb-dev-archive@www.apache.org Received: (qmail 56769 invoked from network); 13 Aug 2009 18:11:33 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 13 Aug 2009 18:11:33 -0000 Received: (qmail 33191 invoked by uid 500); 13 Aug 2009 18:11:39 -0000 Delivered-To: apmail-couchdb-dev-archive@couchdb.apache.org Received: (qmail 33104 invoked by uid 500); 13 Aug 2009 18:11:39 -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 33094 invoked by uid 99); 13 Aug 2009 18:11:39 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 13 Aug 2009 18:11:39 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.140] (HELO brutus.apache.org) (140.211.11.140) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 13 Aug 2009 18:11:36 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id DE4F429A0014 for ; Thu, 13 Aug 2009 11:11:14 -0700 (PDT) Message-ID: <586277793.1250187074909.JavaMail.jira@brutus> Date: Thu, 13 Aug 2009 11:11:14 -0700 (PDT) From: "Robert Newson (JIRA)" To: dev@couchdb.apache.org Subject: [jira] Commented: (COUCHDB-465) Produce sequential, but unique, document id's In-Reply-To: <1495659442.1250179574899.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/COUCHDB-465?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12742911#action_12742911 ] Robert Newson commented on COUCHDB-465: --------------------------------------- Thanks! Guessability is a concern, which means this might need to be switchable. Perhaps couch_seq_generator becomes couch_id_generator and an ini file chooses between the two strategies, defaulting to the safest, but worst-case, new_uuid behavior. To get good keys for b+tree insertion necessarily makes them more guessable as they'd have to be close to existing keys by design. I do owe some quantitative benchmarking to support the assertions in the description. I did a 10k insertion test with a small document, {content: "hello"}, and average insertion rate per document was 2ms with random and 1ms with the patch. This was more to prove that I'd changed *something* rather than a measure of the actual improvement. I would expect to see improved insertion rates across a lot of scenarios, less difference between uncompacted and compacted size (barring document updates and deletes) as less of the b+tree is rewritten, and a smaller post-compaction size vs random. The exact extent of these improvements should be established by a decent benchmark. > Produce sequential, but unique, document id's > --------------------------------------------- > > Key: COUCHDB-465 > URL: https://issues.apache.org/jira/browse/COUCHDB-465 > Project: CouchDB > Issue Type: Improvement > Reporter: Robert Newson > Attachments: sequence_id.patch > > > Currently, if the client does not specify an id (POST'ing a single document or using _bulk_docs) a random 16 byte value is created. This kind of key is particularly brutal on b+tree updates and the append-only nature of couchdb files. > Attached is a patch to change this to a two-part identifier. The first part is a random 12 byte value and the remainder is a counter. The random prefix is rerandomized when the counter reaches its maximum. The rollover in the patch is at 16 million but can obviously be changed. The upshot is that the b+tree is updated in a better fashion, which should lead to performance benefits. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.