Return-Path: X-Original-To: apmail-jackrabbit-dev-archive@www.apache.org Delivered-To: apmail-jackrabbit-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 BCB939065 for ; Tue, 6 Mar 2012 12:47:39 +0000 (UTC) Received: (qmail 36706 invoked by uid 500); 6 Mar 2012 12:47:39 -0000 Delivered-To: apmail-jackrabbit-dev-archive@jackrabbit.apache.org Received: (qmail 36667 invoked by uid 500); 6 Mar 2012 12:47:39 -0000 Mailing-List: contact dev-help@jackrabbit.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@jackrabbit.apache.org Delivered-To: mailing list dev@jackrabbit.apache.org Received: (qmail 36660 invoked by uid 99); 6 Mar 2012 12:47:39 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 06 Mar 2012 12:47:39 +0000 X-ASF-Spam-Status: No, hits=-1.3 required=5.0 tests=FRT_ADOBE2,RCVD_IN_DNSWL_MED,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of b.vanderschans@1hippo.com designates 64.18.2.169 as permitted sender) Received: from [64.18.2.169] (HELO exprod7og108.obsmtp.com) (64.18.2.169) by apache.org (qpsmtpd/0.29) with SMTP; Tue, 06 Mar 2012 12:47:32 +0000 Received: from mail-tul01m020-f175.google.com ([209.85.214.175]) (using TLSv1) by exprod7ob108.postini.com ([64.18.6.12]) with SMTP ID DSNKT1YHT+w8SgPOs9hNUiHfdb9YtqcKsORQ@postini.com; Tue, 06 Mar 2012 04:47:12 PST Received: by mail-tul01m020-f175.google.com with SMTP id v19so8076306obq.34 for ; Tue, 06 Mar 2012 04:47:11 -0800 (PST) Received-SPF: pass (google.com: domain of b.vanderschans@1hippo.com designates 10.182.86.201 as permitted sender) client-ip=10.182.86.201; Authentication-Results: mr.google.com; spf=pass (google.com: domain of b.vanderschans@1hippo.com designates 10.182.86.201 as permitted sender) smtp.mail=b.vanderschans@1hippo.com Received: from mr.google.com ([10.182.86.201]) by 10.182.86.201 with SMTP id r9mr10100122obz.8.1331038031471 (num_hops = 1); Tue, 06 Mar 2012 04:47:11 -0800 (PST) Received: by 10.182.86.201 with SMTP id r9mr8870487obz.8.1331038031343; Tue, 06 Mar 2012 04:47:11 -0800 (PST) MIME-Version: 1.0 Received: by 10.182.73.168 with HTTP; Tue, 6 Mar 2012 04:46:51 -0800 (PST) In-Reply-To: References: From: Bart van der Schans Date: Tue, 6 Mar 2012 13:46:51 +0100 Message-ID: Subject: Re: [jr3] Index on randomly distributed data To: dev@jackrabbit.apache.org Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Gm-Message-State: ALoCoQk0y8Zm6mfhRt9vfOPsq+TXKz1tcfsSecUyk8vSp/tbibtliiZV8GeigmQwDQCAjYnQVjBa X-Virus-Checked: Checked by ClamAV on apache.org Hi Thomas, On Tue, Mar 6, 2012 at 10:34 AM, Thomas Mueller wrote: > Hi, > > In Jackrabbit 2, we currently use a randomly generated UUID as the node > id. For Jackrabbit 3 this is an option question. I was looking for ways t= o > index randomly distributed data, but so far didn't find a solution. A > Google query for "uuid primary key performance" gave me: > > http://stackoverflow.com/questions/2365132/uuid-performance-in-mysql "At > my job, we use UUID as PKs. What I can tell you from experience is DO NOT > USE THEM as PKs ... It's one of those things that when you have less than > 1000 records it;s ok, but when you have millions, it's the worst thing yo= u > can do. Why? Because UUID are not sequential..." > > http://kccoder.com/mysql/uuid-vs-int-insert-performance/ "it takes 25 > hours to insert 15 million records into an empty UUID table" > > http://www.mysqlperformanceblog.com/2007/03/13/to-uuid-or-not-to-uuid/ > "For auto_increment key load process took 1 hour 50 minutes ... For UUID > process took over 12 hours and is still going... =C2=A0So in this little = case > we have about 200 times performance difference" > > I believe if we rely on an index on randomly distributed data, performanc= e > will degrade (factor 10 or more, depending on the repository size, the > memory, and potentially on the number of changes). For Jackrabbit 2, to > solve this performance problem, we can actually switch to sequential node > ids - see JCR-2857. For Jackrabbit 3, if we use the content hash as the > node id, then it wouldn't be possible to switch (it is not possible to > generate sequential content hashes). With content hashes, one option is t= o > make sure the index is always in memory. However, I believe we should not > build a system that has such constraints, unless the alternative > (sequential node ids) has problems we can not solve otherwise. I think this is an important subject. Databases are generally optimized for sequential indexes and will perform better. What I'm wondering about is how we would like to handle the id generation (or the uuid generation for that matter) in a cluster. Do we want to make it the responsibility of the storage layer (aka auto increment, sequences, etc) or the responsibility of jackrabbit? How can we guarantee ids are unique *and* sequential in a cluster without (too much) overhead? Regards, Bart