Return-Path: Delivered-To: apmail-directory-dev-archive@www.apache.org Received: (qmail 75342 invoked from network); 20 Jul 2006 19:06:56 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 20 Jul 2006 19:06:56 -0000 Received: (qmail 40372 invoked by uid 500); 20 Jul 2006 13:35:54 -0000 Delivered-To: apmail-directory-dev-archive@directory.apache.org Received: (qmail 40328 invoked by uid 500); 20 Jul 2006 13:35:53 -0000 Mailing-List: contact dev-help@directory.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Apache Directory Developers List" Delivered-To: mailing list dev@directory.apache.org Received: (qmail 40297 invoked by uid 99); 20 Jul 2006 13:35:53 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 20 Jul 2006 06:35:53 -0700 X-ASF-Spam-Status: No, hits=0.5 required=10.0 tests=DNS_FROM_RFC_ABUSE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: domain of ersin.er@gmail.com designates 64.233.182.189 as permitted sender) Received: from [64.233.182.189] (HELO nf-out-0910.google.com) (64.233.182.189) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 20 Jul 2006 06:35:52 -0700 Received: by nf-out-0910.google.com with SMTP id o25so524912nfa for ; Thu, 20 Jul 2006 06:35:31 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:user-agent:mime-version:to:subject:content-type:content-transfer-encoding; b=i3VlprNRkzV+xR86qaToC2CeXJ714UCy6b6f3dz6rYBWBVXhJvhV7dQPWoDdbetUONKepJt+cQh/HUQkdsazk/K66lvCApr74K6jAaDU+ovU9e2/cy5JjchaZ4HZC7Lj/9sul5rWQntUhFCTjQAOEy56YzPSYpZ7wZyjrw6BPf4= Received: by 10.48.235.13 with SMTP id i13mr499985nfh; Thu, 20 Jul 2006 06:35:29 -0700 (PDT) Received: from ?10.0.0.13? ( [88.232.35.99]) by mx.gmail.com with ESMTP id c10sm340536nfb.2006.07.20.06.35.28; Thu, 20 Jul 2006 06:35:29 -0700 (PDT) Message-ID: <44BF86A1.8050206@gmail.com> Date: Thu, 20 Jul 2006 16:35:29 +0300 From: Ersin Er User-Agent: Thunderbird 1.5.0.4 (X11/20060614) MIME-Version: 1.0 To: Apache Directory Developers List Subject: Optimizing DB access with improving key usage Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Hi all, The optimization branch is busy with extensive refactorings and things are going well. We had a few convos recently for further improving the performance and one of the points of improvement was thought as replacing the BigInteger construct which we use as the key of Attributes objects in the database. What we do when retrieving and Attributes object is first retrieving a BigInteger stored in the db for the normalized DN and then doing one more lookup for the actual Attributes object using the BigInteger as the key. The first improvement to be done is to replace BigInteger with int or long which cost much less. But as Alex just (yes, at the time of writing this :) ) warned me about that jdbm keys should be objects not primitives. So my second suggestion is again replacing the BigInteger with more leightweight class like Integer and generating that Integer for each LdapDN at the time of construction. I think we do not need to do one more lookup to retrieve the (Big)Integer key of the Attributes object. We can just generate a hash value at LdapDN constructor and provide a method for accessing it when we want to store or retrieve Attributes objects. Of course, the hash code should be generated from normalized components of the DN. As a DN is a primary key for an LDAP tree, again a unique key generated from it will serve as the primary key for the whole backend DB. WDYT ? -- Ersin