Return-Path: X-Original-To: apmail-directory-dev-archive@www.apache.org Delivered-To: apmail-directory-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 67952C703 for ; Tue, 10 Sep 2013 16:06:25 +0000 (UTC) Received: (qmail 76992 invoked by uid 500); 10 Sep 2013 16:06:25 -0000 Delivered-To: apmail-directory-dev-archive@directory.apache.org Received: (qmail 76797 invoked by uid 500); 10 Sep 2013 16:06:24 -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 76790 invoked by uid 99); 10 Sep 2013 16:06:24 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 10 Sep 2013 16:06:24 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of elecharny@gmail.com designates 209.85.212.169 as permitted sender) Received: from [209.85.212.169] (HELO mail-wi0-f169.google.com) (209.85.212.169) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 10 Sep 2013 16:06:18 +0000 Received: by mail-wi0-f169.google.com with SMTP id hj3so884132wib.4 for ; Tue, 10 Sep 2013 09:05:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:content-type:content-transfer-encoding; bh=3+j82VuErKlpOCBudXlPzKkWXp5QW7+WYLVhyifAio0=; b=yBs2T5JXLEARNP2lrHXA6GKC0VrWQZsWiYO+RT4uQVWRjcCxctRC5xxOD0CGYnCKT1 wSDUz1pPMlXCL93fTJjd97SU5pd0skR7z9ckbVZ+S6DpMTwr/sRfvCfk8pB+lEnDnt8w RQjVFDtgnO+kAxoXx6txrtLWcBry1qz1qHoLntOJNtcFJHFfzcaM6IBzSVwxBRKVDZHM BjbB4E3k6QkHJQTE2adz8u739tSSX1DFIPRgmgcziqNfuCCUg7olh7ol9GJ5ITkKlFvO V1wmsPDT84HuYiBGredfIg9CJtA2qMsTnXBPnGLxb0J4waDo50+F1RFZxleqX7nr5y2j C1Dw== X-Received: by 10.194.21.131 with SMTP id v3mr2573239wje.44.1378829157625; Tue, 10 Sep 2013 09:05:57 -0700 (PDT) Received: from Emmanuels-MacBook-Pro.local (lon92-10-78-226-4-211.fbx.proxad.net. [78.226.4.211]) by mx.google.com with ESMTPSA id l9sm4485788wif.10.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 10 Sep 2013 09:05:57 -0700 (PDT) Message-ID: <522F4364.4090805@gmail.com> Date: Tue, 10 Sep 2013 18:05:56 +0200 From: =?UTF-8?B?RW1tYW51ZWwgTMOpY2hhcm55?= User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:17.0) Gecko/20130801 Thunderbird/17.0.8 MIME-Version: 1.0 To: dev@directory.apache.org Subject: Re: Mavibot cache experiment References: <522F3D81.6070609@symas.com> In-Reply-To: <522F3D81.6070609@symas.com> X-Enigmail-Version: 1.5.2 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Virus-Checked: Checked by ClamAV on apache.org Le 9/10/13 5:40 PM, Emmanuel Lécharny a écrit : > Hi guys, > > yestrday and today, I was implementing a cache in Mavibot to replace the > WeakReferences we were using previously. The rational was that with the > WeakReferences, we were unable to inject more than 50 000 entries in the > server (at this point, the GC is just going crazy trying to free some > WeakReferences, and it slows down the server to a pint it's unusable...) > > So after a day fighting with an EhCache implementation in Mavibot, I was > able to load 100K entries in the server. So far, so good, except that > the performances are anything but good. I can add 26 entries per second, > and fetch 555 entries per second. Worse than JDBM... > > Why is it so slow, especially for a search operation ? There are two > reasons : > - first, I configured the cache to store only 1000 elements (mainly nodes) > - second, when we try to update a leaf, we mostly have to load it from > disk, as we rarely have it in memory > - third, a leaf contains from 8 to 16 entries, and everytime we fetch a > leaf from disk, we have to deserialize the Entries, which is extremely > costly > > Fixing this third problem would save us a lot of time, and it's a matter > of adding one level of indirection (the entries would be kept as byte[], > and deserialized only when needed). > > If anyone has a better idea... indeed : the pb is that we serialize/deserialize too late. It would be way better if we process serialized values until the point we return the result to the user : - addition : we receive an object, we immediately serialize it into a byte[] and process the addition using this byte[]. We don't anymore have to deserialize all the values from the page we will add the new value, they are all byte[] - search : same thing, we don't deserialize the values until we return it to the user. The gain will be huge ! -- Regards, Cordialement, Emmanuel Lécharny www.iktek.com