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 7632F10747 for ; Mon, 2 Sep 2013 17:11:46 +0000 (UTC) Received: (qmail 16531 invoked by uid 500); 2 Sep 2013 17:11:46 -0000 Delivered-To: apmail-directory-dev-archive@directory.apache.org Received: (qmail 16335 invoked by uid 500); 2 Sep 2013 17:11:42 -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 16326 invoked by uid 99); 2 Sep 2013 17:11:40 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 02 Sep 2013 17:11:40 +0000 X-ASF-Spam-Status: No, hits=1.7 required=5.0 tests=FREEMAIL_ENVFROM_END_DIGIT,HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of srivastavamohit91@gmail.com designates 209.85.212.44 as permitted sender) Received: from [209.85.212.44] (HELO mail-vb0-f44.google.com) (209.85.212.44) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 02 Sep 2013 17:11:34 +0000 Received: by mail-vb0-f44.google.com with SMTP id e13so3158563vbg.17 for ; Mon, 02 Sep 2013 10:11:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=jysIVDc79nVq8c7tkjk+ATp4lBGvBUhOtga+CeNbVd4=; b=dGIW9ZLuaKMmG4OZ2gDSAjWgcjORva+bSGJ9+uYdkHbz6c2ENx+K5d9+UPQ/AeG76e Av1xw4WXNq/i6PDFpw1FkYtHJmIj7F42nOqLOOSPDOwYwJxE6TUIyXWXL9oHmhMoeHKe Oz1ZwxtAXI6ss3kehFZXWAASu6DcYSoPE63Y+wK2sAYk8VlOCYazm/SeDqHa3ObWFvBc m4OgvlysOIxtak6iLp9j7HAy5nZa5LqKwhxHj2R2YDyYRbuNnqf1XX4Y1MKW8h+IwEh+ DxUxghX8LCuTZ5rgDAkkBT+I1nInQXtTqoSNvly6cMFpXzXa2mIw+e/ZPYR769iSOwet RbLg== MIME-Version: 1.0 X-Received: by 10.52.52.231 with SMTP id w7mr10995839vdo.12.1378141873152; Mon, 02 Sep 2013 10:11:13 -0700 (PDT) Received: by 10.58.215.201 with HTTP; Mon, 2 Sep 2013 10:11:13 -0700 (PDT) In-Reply-To: <52245422.2090209@gmail.com> References: <52245422.2090209@gmail.com> Date: Mon, 2 Sep 2013 22:41:13 +0530 Message-ID: Subject: Re: [Mavibot] Need for a cache to replace the WeakReferences... From: Mohit Srivastava To: Apache Directory Developers List Content-Type: multipart/alternative; boundary=089e0122f5f6ccada704e569a8e4 X-Virus-Checked: Checked by ClamAV on apache.org --089e0122f5f6ccada704e569a8e4 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable I think we can use EhCache for now. Also modify it for our purposes. On 2 September 2013 14:32, Emmanuel L=E9charny wrote: > Hi guys, > > I have done some tests a week ago on Mavibot partition. It appears that > we have a serious performance issue as soon as the JVM memory is > completly eaten, when adding some entries. What happens is that we start > to discard some pages as they are hold by WeakReferences, and the GC has > to do quite a expensive processing to get back some free memory. This > slows down the add operation so much (by at least a factor 10) that it's > not possible to keep going with WeakReferences (or SoftReferences). > > At this point, the best solution would be to use a cache to replace this > mechanism. > > There are different things we can cache : > o PageIo : it's useless, as we still have to deserialize them afterward > o Nodes and Leaves : They contain references to other Nodes or Leaves, > and for Leaves, reference to data. Holding the upper Nodes would save us > a lot of time > o Data : the ultimate objects to cache : having the object in cache > spares us the time it takes to searcj it in a Btree > > A few other things to consider : > o we need a versionned cache : all the elements may be versionned. > o each BTree may be cached, with different configuation (some BTree may > be used rarely, other may be heavily used, requiring a more aggressive > cache configuration) > o the Cache must not use locks, but CAS (Compare-And-Swap) for better > performance > > At this point, I suggest using EhCache as a first approach, in order to > leverage the cache we already use in the server, but we may want to > design our own LRU cache (something that should not be too complex to > implement). > > Thoughts ? > > -- > Regards, > Cordialement, > Emmanuel L=E9charny > www.iktek.com > > --089e0122f5f6ccada704e569a8e4 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
I think we can use EhCache for now. Also modify it for our= purposes.


On 2 September 2013 14:32, Emmanuel L=E9charny <elecharny@gmail.com> wrote:
Hi guys,

I have done some tests a week ago on Mavibot partition. It appears that
we have a serious performance issue as soon as the JVM memory is
completly eaten, when adding some entries. What happens is that we start to discard some pages as they are hold by WeakReferences, and the GC has to do quite a expensive processing to get back some free memory. This
slows down the add operation so much (by at least a factor 10) that it'= s
not possible to keep going with WeakReferences (or SoftReferences).

At this point, the best solution would be to use a cache to replace this mechanism.

There are different things we can cache :
o PageIo : it's useless, as we still have to deserialize them afterward=
o Nodes and Leaves : They contain references to other Nodes or Leaves,
and for Leaves, reference to data. Holding the upper Nodes would save us a lot of time
o Data : the ultimate objects to cache : having the object in cache
spares us the time it takes to searcj it in a Btree

A few other things to consider :
o we need a versionned cache : all the elements may be versionned.
o each BTree may be cached, with different configuation (some BTree may
be used rarely, other may be heavily used, requiring a more aggressive
cache configuration)
o the Cache must not use locks, but CAS (Compare-And-Swap) for better
performance

At this point, I suggest using EhCache as a first approach, in order to
leverage the cache we already use in the server, but we may want to
design our own LRU cache (something that should not be too complex to
implement).

Thoughts ?

--
Regards,
Cordialement,
Emmanuel L=E9charny
www.iktek.com


--089e0122f5f6ccada704e569a8e4--